Search API: use a single query with result and count
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
type InventaireSearchResult struct {
|
||||
Results []InventaireSearchBook `json:"results"`
|
||||
Total int `json:"total"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
type InventaireSearchBook struct {
|
||||
|
||||
@@ -11,7 +11,7 @@ func TestCallInventaireSearch_NoParameters(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.Equal(t, 17, result.Total)
|
||||
assert.Equal(t, int64(17), result.Total)
|
||||
assert.Equal(t, 10, len(result.Results))
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestCallInventaireSearch_NoLimit(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.Equal(t, 17, result.Total)
|
||||
assert.Equal(t, int64(17), result.Total)
|
||||
assert.Equal(t, 10, len(result.Results))
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestCallInventaireSearch_Limit(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.Equal(t, 17, result.Total)
|
||||
assert.Equal(t, int64(17), result.Total)
|
||||
assert.Equal(t, 5, len(result.Results))
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestCallInventaireSearch_Offset(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.Equal(t, 17, result.Total)
|
||||
assert.Equal(t, int64(17), result.Total)
|
||||
assert.Equal(t, 2, len(result.Results))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user