Phase C4 executor 의 마지막 `fix(test): clippy + fmt fixes` commit 이 test file 부분만 fmt 적용. workspace 전체 fmt 누락 발견 → cargo fmt --all 적용. 모든 import alphabetical reorder + line wrapping 정합. 추가 untracked artifact 동시 commit: - docs/superpowers/specs/2026-05-28-v0.20-ingest-log-spec.md (491 line, ACCEPT) - docs/superpowers/plans/2026-05-28-v0.20-ingest-log-plan.md (616 line, ACCEPT) workspace test: 1370 passed / 0 failed / 50 ignored, ingest_log_smoke green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
31 lines
1.0 KiB
Rust
31 lines
1.0 KiB
Rust
//! Signal test: `SqliteStore::open_existing` emits `NotIndexed` when the DB
|
|
//! file is absent.
|
|
|
|
use kebab_store_sqlite::{NotIndexed, SqliteStore};
|
|
|
|
#[test]
|
|
fn not_indexed_signal_emitted_when_db_missing() {
|
|
let dir = tempfile::tempdir().unwrap();
|
|
let nonexistent_db = dir.path().join("does-not-exist.sqlite");
|
|
let res = SqliteStore::open_existing(&nonexistent_db);
|
|
let err = match res {
|
|
Ok(_) => panic!("opening a missing DB should fail"),
|
|
Err(e) => e,
|
|
};
|
|
let signal = err
|
|
.downcast_ref::<NotIndexed>()
|
|
.expect("missing DB error should downcast to NotIndexed");
|
|
assert_eq!(signal.expected, nonexistent_db.to_string_lossy().as_ref());
|
|
}
|
|
|
|
#[test]
|
|
fn open_existing_does_not_create_missing_db() {
|
|
let dir = tempfile::tempdir().unwrap();
|
|
let nonexistent_db = dir.path().join("does-not-exist.sqlite");
|
|
let _ = SqliteStore::open_existing(&nonexistent_db);
|
|
assert!(
|
|
!nonexistent_db.exists(),
|
|
"open_existing must NOT create the file"
|
|
);
|
|
}
|