Unexported unnecessary members
This commit is contained in:
parent
4da8e94bcc
commit
d8a295be75
14 changed files with 134 additions and 115 deletions
|
|
@ -2,16 +2,39 @@ package cardsinfo
|
|||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/h2non/gock.v1"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFetcher_GetFormattedCardPrices_Error(t *testing.T) {
|
||||
defer gock.Off()
|
||||
|
||||
gock.New(scgSearchUrlTemplate + "card").Reply(http.StatusInternalServerError)
|
||||
f := &Fetcher{}
|
||||
_, err := f.GetFormattedCardPrices("card")
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestFetcher_GetFormattedCardPrices_Empty(t *testing.T) {
|
||||
defer gock.Off()
|
||||
|
||||
resp, _ := os.Open("test_data/EmptyTest.html")
|
||||
gock.New(scgSearchUrlTemplate + "card").Reply(http.StatusOK).Body(resp)
|
||||
f := &Fetcher{}
|
||||
msg, err := f.GetFormattedCardPrices("card")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "Оригинальное название: card\nРезультатов: 0\n", msg)
|
||||
}
|
||||
|
||||
func TestFormatCardPrices(t *testing.T) {
|
||||
f := &Fetcher{}
|
||||
formatted := f.FormatCardPrices("card", []CardPrice{
|
||||
&ScgCardPrice{
|
||||
Price: "1.5$",
|
||||
Edition: "ED",
|
||||
Link: "scg.com",
|
||||
formatted := f.formatCardPrices("card", []scgCardPrice{
|
||||
{
|
||||
price: "1.5$",
|
||||
edition: "ED",
|
||||
link: "scg.com",
|
||||
},
|
||||
})
|
||||
assert.Equal(t, "Оригинальное название: card\nРезультатов: 1\n1. ED: 1.5$\nscg.com\n", formatted)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue