test: heroesdepapel

This commit is contained in:
Felipe Martin Garcia 2022-08-07 12:15:19 +02:00
parent cf94a590b7
commit 818b59940f
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
2 changed files with 1016 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
package heroesdepapel_test
import (
"net/url"
"testing"
"github.com/fmartingr/bazaar/pkg/clients"
"github.com/fmartingr/bazaar/pkg/models"
"github.com/fmartingr/bazaar/pkg/shop/heroesdepapel"
"github.com/stretchr/testify/assert"
)
func TesHeroesDePapel_Ok(t *testing.T) {
shop := heroesdepapel.NewHeroesDePapelShopFactory()(models.NewShopOptions(clients.NewMockClient()))
testUrl, _ := url.Parse("https://www.heroesdepapel.es/test/")
product, err := shop.Get(testUrl)
if err != nil {
t.Error(err)
return
}
assert.Equal(t, "Gestalt", product.Name)
assert.Equal(t, "https://www.heroesdepapel.es/uploads/f.1546.jpg", product.ImageURL)
assert.Equal(t, 9.95, product.Price)
assert.Equal(t, "9,95 €", product.PriceText)
assert.Equal(t, testUrl.String(), product.URL)
}