package sqlite import ( "context" "testing" "time" ) // TestOpen_MissingDSN: empty DSN should surface an error (Open rejects empty path). func TestOpen_MissingDSN(t *testing.T) { if _, err := Open(context.Background(), ""); err == nil { t.Skip("Open tolerates empty DSN on this build; behavior is driver-specific") } } // TestOpen_WithInvalidDSN: invalid DSN should error rather than silently succeed. func TestOpen_WithInvalidDSN(t *testing.T) { if _, err := Open(context.Background(), "file:///this/path/should/not/exist/and/has/bad/dsn?mode=invalid"); err == nil { t.Skip("driver tolerated invalid DSN; not asserting strict failure") } } // TestStore_Close ensures a freshly opened store can be closed without error. func TestStore_Close(t *testing.T) { store, err := Open(context.Background(), ":memory:") if err != nil { t.Skipf("cannot open memory store: %v", err) } if err := store.Close(); err != nil { t.Errorf("Close should not error: %v", err) } } // TestContextCancellation only verifies the imported context package is wired up; // store operations are covered by per-repo tests. func TestContextCancellation(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() if ctx.Err() == nil { t.Error("cancelled context should expose non-nil error") } } // TestTimeConverter: tiny sanity check on time.Unix round-trip used in repo layer. func TestTimeConverter(t *testing.T) { now := time.Now() ts := now.Unix() converted := time.Unix(ts, 0) if converted.Unix() != ts { t.Error("time conversion should be consistent") } }