(t *testing.T)
| 127 | } |
| 128 | |
| 129 | func 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 | |
| 152 | func TestUpdateNote(t *testing.T) { |
| 153 | testCases := []struct { |
nothing calls this directly
no test coverage detected