MCPcopy
hub / github.com/dnote/dnote / InitTestFileDB

Function InitTestFileDB

pkg/cli/database/testutils.go:62–67  ·  view source on GitHub ↗

InitTestFileDB initializes a file-based test database with the default schema.

(t *testing.T)

Source from the content-addressed store, hash-verified

60
61// InitTestFileDB initializes a file-based test database with the default schema.
62func InitTestFileDB(t *testing.T) (*DB, string) {
63 uuid := mustGenerateTestUUID(t)
64 dbPath := filepath.Join(t.TempDir(), fmt.Sprintf("dnote-%s.db", uuid))
65 db := InitTestFileDBRaw(t, dbPath)
66 return db, dbPath
67}
68
69// InitTestFileDBRaw initializes a file-based test database at the specified path with the default schema.
70func InitTestFileDBRaw(t *testing.T, dbPath string) *DB {

Callers 6

TestAddNoteFunction · 0.92
TestEditNoteFunction · 0.92
TestEditBookFunction · 0.92
TestRemoveNoteFunction · 0.92
TestRemoveBookFunction · 0.92
TestViewFunction · 0.92

Calls 2

mustGenerateTestUUIDFunction · 0.85
InitTestFileDBRawFunction · 0.85

Tested by 6

TestAddNoteFunction · 0.74
TestEditNoteFunction · 0.74
TestEditBookFunction · 0.74
TestRemoveNoteFunction · 0.74
TestRemoveBookFunction · 0.74
TestViewFunction · 0.74