Added href parsing

This commit is contained in:
Artyom Belousov 2019-05-11 19:00:58 +03:00
parent 738142f27f
commit c0f781fc7a
6 changed files with 78 additions and 7 deletions

View file

@ -0,0 +1,27 @@
package tests
import (
"github.com/flygrounder/mtg-price-vk/cardsinfo"
"github.com/stretchr/testify/assert"
"testing"
)
func TestFormat(t *testing.T) {
data := []cardsinfo.CardPrice{
{
Name: "Green lotus",
Price: 22.8,
Link: "scg.com/1",
Edition: "alpha",
},
{
Name: "White lotus",
Price: 3.22,
Link: "scg.com/2",
Edition: "gamma",
},
}
res := cardsinfo.FormatCardPrices("Black Lotus", data)
ans := "Оригинальное название: Black Lotus\nРезультатов: 2\n1. alpha: $22.8\nscg.com/1\n2. gamma: $3.22\nscg.com/2\n"
assert.Equal(t, res, ans)
}