Use the same widget for books everywhere
This commit is contained in:
@@ -25,7 +25,7 @@ func TestSearchBook_OneBookNotUserBook(t *testing.T) {
|
||||
result := testSearchBook(t, "iliade", "", "")
|
||||
assert.Equal(t, int64(1), result.Count)
|
||||
assert.Equal(t,
|
||||
[]dto.BookSearchGetBook{{
|
||||
[]dto.BookItemGet{{
|
||||
Title: "Iliade",
|
||||
Author: "Homère",
|
||||
ID: 29,
|
||||
@@ -41,7 +41,7 @@ func TestSearchBook_OneBookRead(t *testing.T) {
|
||||
result := testSearchBook(t, "dieux", "", "")
|
||||
assert.Equal(t, int64(1), result.Count)
|
||||
assert.Equal(t,
|
||||
[]dto.BookSearchGetBook{{
|
||||
[]dto.BookItemGet{{
|
||||
Title: "Les dieux ont soif",
|
||||
Author: "Anatole France",
|
||||
ID: 4,
|
||||
@@ -58,7 +58,7 @@ func TestSearchBook_OneBookStartRead(t *testing.T) {
|
||||
result := testSearchBook(t, "Recherches", "", "")
|
||||
assert.Equal(t, int64(1), result.Count)
|
||||
assert.Equal(t,
|
||||
[]dto.BookSearchGetBook{{
|
||||
[]dto.BookItemGet{{
|
||||
Title: "Recherches philosophiques",
|
||||
Author: "Ludwig Wittgenstein",
|
||||
ID: 30,
|
||||
@@ -75,7 +75,7 @@ func TestSearchBook_ISBN(t *testing.T) {
|
||||
result := testSearchBook(t, "9782070337903", "", "")
|
||||
assert.Equal(t, int64(1), result.Count)
|
||||
assert.Equal(t,
|
||||
[]dto.BookSearchGetBook{{
|
||||
[]dto.BookItemGet{{
|
||||
Title: "Le complot contre l'Amérique",
|
||||
Author: "Philip Roth",
|
||||
ID: 22,
|
||||
@@ -91,7 +91,7 @@ func TestSearchBook_ISBNInventaire(t *testing.T) {
|
||||
result := testSearchBook(t, "9782253158400", "", "")
|
||||
assert.Equal(t, int64(1), result.Count)
|
||||
assert.Equal(t,
|
||||
[]dto.BookSearchGetBook{{
|
||||
[]dto.BookItemGet{{
|
||||
ID: 0,
|
||||
Title: "Les premières enquêtes de Maigret",
|
||||
Author: "Georges Simenon",
|
||||
@@ -117,7 +117,7 @@ func TestSearchBook_Offset(t *testing.T) {
|
||||
assert.Equal(t, 3, len(result.Books))
|
||||
}
|
||||
|
||||
func testSearchBook(t *testing.T, searchterm string, limit string, offset string) dto.BookSearchGet {
|
||||
func testSearchBook(t *testing.T, searchterm string, limit string, offset string) dto.BookItemsGet {
|
||||
router := testutils.TestSetup()
|
||||
|
||||
u, err := url.Parse("/ws/search/" + searchterm)
|
||||
@@ -145,7 +145,7 @@ func testSearchBook(t *testing.T, searchterm string, limit string, offset string
|
||||
w := httptest.NewRecorder()
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
var result dto.BookSearchGet
|
||||
var result dto.BookItemsGet
|
||||
s := w.Body.String()
|
||||
err = json.Unmarshal([]byte(s), &result)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user