Rename author to authors and subject to tags
This commit is contained in:
parent
e72de38725
commit
7f9c172853
17 changed files with 37 additions and 39 deletions
|
@ -3,9 +3,9 @@ package database
|
|||
import "testing"
|
||||
|
||||
var book = Book{
|
||||
Id: "r_m-IOzzIbA6QK5w",
|
||||
Title: "some title",
|
||||
Author: []string{"Alice", "Bob"},
|
||||
Id: "r_m-IOzzIbA6QK5w",
|
||||
Title: "some title",
|
||||
Authors: []string{"Alice", "Bob"},
|
||||
}
|
||||
|
||||
func TestAddAndDeleteBook(t *testing.T) {
|
||||
|
@ -61,8 +61,8 @@ func TestActiveBook(t *testing.T) {
|
|||
if !b.Active {
|
||||
t.Error("Book is not activated")
|
||||
}
|
||||
if b.Author[0] != books[0].Author[0] {
|
||||
t.Error("Book author don't match : '", b.Author, "' <=> '", book.Author, "'")
|
||||
if b.Authors[0] != books[0].Authors[0] {
|
||||
t.Error("Book author don't match : '", b.Authors, "' <=> '", book.Authors, "'")
|
||||
}
|
||||
|
||||
bs, num, err := db.GetBooks(book.Title, 20, 0)
|
||||
|
@ -72,8 +72,8 @@ func TestActiveBook(t *testing.T) {
|
|||
if num != 1 || len(bs) != 1 {
|
||||
t.Fatal("We got a un expected number of books: ", num, bs)
|
||||
}
|
||||
if bs[0].Author[0] != book.Author[0] {
|
||||
t.Error("Book author don't match : '", bs[0].Author, "' <=> '", book.Author, "'")
|
||||
if bs[0].Authors[0] != book.Authors[0] {
|
||||
t.Error("Book author don't match : '", bs[0].Authors, "' <=> '", book.Authors, "'")
|
||||
}
|
||||
|
||||
bs, num, err = db.GetBooks("none", 20, 0)
|
||||
|
|
Reference in a new issue