(t *testing.T)
| 347 | } |
| 348 | |
| 349 | func TestUpdateBookName(t *testing.T) { |
| 350 | // set up |
| 351 | db := InitTestMemoryDB(t) |
| 352 | |
| 353 | b1UUID := "b1-uuid" |
| 354 | MustExec(t, "inserting b1", db, "INSERT INTO books (uuid, label, usn, deleted, dirty) VALUES (?, ?, ?, ?, ?)", b1UUID, "b1-label", 8, false, false) |
| 355 | |
| 356 | // execute |
| 357 | err := UpdateBookName(db, b1UUID, "b1-label-edited") |
| 358 | if err != nil { |
| 359 | t.Fatal(errors.Wrap(err, "executing")) |
| 360 | } |
| 361 | |
| 362 | // test |
| 363 | var b1 Book |
| 364 | MustScan(t, "getting the note record", db.QueryRow("SELECT uuid, label, dirty, usn, deleted FROM books WHERE uuid = ?", b1UUID), &b1.UUID, &b1.Label, &b1.Dirty, &b1.USN, &b1.Deleted) |
| 365 | assert.Equal(t, b1.UUID, b1UUID, "UUID mismatch") |
| 366 | assert.Equal(t, b1.Label, "b1-label-edited", "Label mismatch") |
| 367 | assert.Equal(t, b1.Dirty, true, "Dirty mismatch") |
| 368 | assert.Equal(t, b1.USN, 8, "USN mismatch") |
| 369 | assert.Equal(t, b1.Deleted, false, "Deleted mismatch") |
| 370 | } |
nothing calls this directly
no test coverage detected