MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestCmdInitCreatesDBQueryable

Function TestCmdInitCreatesDBQueryable

internal/app/init_test.go:50–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestCmdInitCreatesDBQueryable(t *testing.T) {
51 root := initTempFlowRoot(t)
52 if rc := cmdInit(nil); rc != 0 {
53 t.Fatalf("cmdInit rc=%d", rc)
54 }
55 dbPath := filepath.Join(root, "flow.db")
56 if _, err := os.Stat(dbPath); err != nil {
57 t.Fatalf("flow.db missing: %v", err)
58 }
59 db, err := flowdb.OpenDB(dbPath)
60 if err != nil {
61 t.Fatalf("OpenDB: %v", err)
62 }
63 defer db.Close()
64 // Confirm a core table exists.
65 var name string
66 if err := db.QueryRow("SELECT name FROM sqlite_master WHERE type='table' AND name='tasks'").Scan(&name); err != nil {
67 t.Errorf("tasks table missing: %v", err)
68 }
69}
70
71func TestCmdInitIdempotent(t *testing.T) {
72 root := initTempFlowRoot(t)

Callers

nothing calls this directly

Calls 3

OpenDBFunction · 0.92
initTempFlowRootFunction · 0.85
cmdInitFunction · 0.85

Tested by

no test coverage detected