(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestViewNoteContentOnly(t *testing.T) { |
| 50 | db := database.InitTestMemoryDB(t) |
| 51 | defer db.Close() |
| 52 | |
| 53 | bookUUID := "test-book-uuid" |
| 54 | database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", bookUUID, "golang") |
| 55 | database.MustExec(t, "inserting note", db, "INSERT INTO notes (uuid, book_uuid, body, added_on) VALUES (?, ?, ?, ?)", |
| 56 | "note-uuid", bookUUID, "test note content", 1515199943000000000) |
| 57 | |
| 58 | ctx := context.DnoteCtx{DB: db} |
| 59 | var buf bytes.Buffer |
| 60 | |
| 61 | err := viewNote(ctx, &buf, "1", true) |
| 62 | if err != nil { |
| 63 | t.Fatal(err) |
| 64 | } |
| 65 | |
| 66 | got := buf.String() |
| 67 | assert.Equal(t, got, "test note content", "should contain only note content") |
| 68 | } |
| 69 | |
| 70 | func TestViewNoteInvalidRowID(t *testing.T) { |
| 71 | db := database.InitTestMemoryDB(t) |
nothing calls this directly
no test coverage detected