Add open library API call when search has no result
This commit is contained in:
27
internal/openlibrary/openlibrary_test.go
Normal file
27
internal/openlibrary/openlibrary_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package openlibrary_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.artlef.fr/PersonalLibraryManager/internal/openlibrary"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCallOpenLibrary(t *testing.T) {
|
||||
result, err := openlibrary.CallOpenLibrary("man in high castle", 0, 0)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, result.NumFound, 25)
|
||||
assert.Equal(t, len(result.Books), 25)
|
||||
}
|
||||
|
||||
func TestCallOpenLibraryLimit(t *testing.T) {
|
||||
result, err := openlibrary.CallOpenLibrary("man in high castle", 10, 0)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, len(result.Books), 10)
|
||||
}
|
||||
|
||||
func TestCallOpenLibraryOffset(t *testing.T) {
|
||||
result, err := openlibrary.CallOpenLibrary("man in high castle", 0, 10)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, len(result.Books), 15)
|
||||
}
|
||||
Reference in New Issue
Block a user