Add import edition from inventaire

This commit is contained in:
2026-02-01 21:49:11 +01:00
parent 27a9faf704
commit 464405f5c9
13 changed files with 266 additions and 162 deletions

View File

@@ -43,7 +43,7 @@ func TestCallInventaireSearch_Offset(t *testing.T) {
}
func TestCallInventaireBook_BraveNewWorld(t *testing.T) {
result, err := CallInventaireBook("Q191949", "fr")
result, err := callInventaireBook("wd:Q191949", "fr")
if err != nil {
t.Error(err)
}
@@ -54,8 +54,8 @@ func TestCallInventaireBook_BraveNewWorld(t *testing.T) {
assert.Equal(t, "écrivain, romancier et philosophe britannique (18941963)", result.Author.Description)
}
func TestCallInventaireEdition_TestLimit(t *testing.T) {
result, err := CallInventaireEdition("wd:Q339761", "fr", 10, 0)
func TestCallInventaireEditionFromWork_TestLimit(t *testing.T) {
result, err := CallInventaireEditionFromWork("wd:Q339761", "fr", 10, 0)
if err != nil {
t.Error(err)
}
@@ -63,8 +63,8 @@ func TestCallInventaireEdition_TestLimit(t *testing.T) {
assert.Equal(t, 10, len(result.Results))
}
func TestCallInventaireEdition_TestOffset(t *testing.T) {
result, err := CallInventaireEdition("wd:Q3213142", "fr", 0, 0)
func TestCallInventaireEditionFromWork_TestOffset(t *testing.T) {
result, err := CallInventaireEditionFromWork("wd:Q3213142", "fr", 0, 0)
if err != nil {
t.Error(err)
}
@@ -101,3 +101,27 @@ func TestCallInventaireEdition_TestOffset(t *testing.T) {
},
result.Results[2])
}
func TestCallInventaireEdition(t *testing.T) {
result, err := CallInventaireEdition("isbn:9782266003698", "fr")
if err != nil {
t.Error(err)
}
assert.Equal(t,
InventaireEditionDetailedSingleResult{
Id: "isbn:9782266003698",
Title: "Bel-Ami",
Author: &InventaireAuthorResult{
ID: "Q9327",
Name: "Guy de Maupassant",
Description: "écrivain et journaliste littéraire français (1850-1893)",
},
Description: "roman de Guy De Maupassant",
ISBN: "978-2-266-00369-8",
Publisher: "Pocket",
ReleaseDate: "1977",
Image: "https://inventaire.io/img/entities/b237c0b5de5f6c765928d9eee26b55804a33557a",
Lang: "fr",
},
result)
}