MCPcopy Index your code
hub / github.com/dnote/dnote / TestCreateNote_EmptyBody

Function TestCreateNote_EmptyBody

pkg/server/app/notes_test.go:129–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

127}
128
129func TestCreateNote_EmptyBody(t *testing.T) {
130 db := testutils.InitMemoryDB(t)
131
132 user := testutils.SetupUserData(db, "user@test.com", "password123")
133 b1 := database.Book{UserID: user.ID, Label: "testBook"}
134 testutils.MustExec(t, db.Save(&b1), "preparing book")
135
136 a := NewTest()
137 a.DB = db
138 a.Clock = clock.NewMock()
139
140 // Create note with empty body
141 note, err := a.CreateNote(user, b1.UUID, "", nil, nil, "")
142 if err != nil {
143 t.Fatal(errors.Wrap(err, "creating note with empty body"))
144 }
145
146 // Assert FTS entry exists with empty body
147 var ftsBody string
148 testutils.MustExec(t, db.Raw("SELECT body FROM notes_fts WHERE rowid = ?", note.ID).Scan(&ftsBody), "querying notes_fts for empty body note")
149 assert.Equal(t, ftsBody, "", "FTS body should be empty for note created with empty body")
150}
151
152func TestUpdateNote(t *testing.T) {
153 testCases := []struct {

Callers

nothing calls this directly

Calls 7

InitMemoryDBFunction · 0.92
SetupUserDataFunction · 0.92
MustExecFunction · 0.92
NewMockFunction · 0.92
EqualFunction · 0.92
NewTestFunction · 0.85
CreateNoteMethod · 0.80

Tested by

no test coverage detected