mtg-price-bot/internal/telegram/sender_test.go
2021-06-25 13:01:55 +03:00

31 lines
782 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package telegram
import (
"testing"
"github.com/stretchr/testify/assert"
"gitlab.com/flygrounder/go-mtg-vk/internal/cardsinfo"
)
func Test_formatCardPrices(t *testing.T) {
prices := []cardsinfo.ScgCardPrice{
{
Price: "1",
Edition: "Alpha",
Link: "scg1",
},
{
Price: "2",
Edition: "Beta",
Link: "scg2",
},
}
result := formatCardPrices("card", prices)
assert.Equal(t, "Оригинальное название: card\n\n1. [Alpha](scg1): 1\n2. [Beta](scg2): 2\n", result)
}
func Test_formatCardPricesEscapeUnderscore(t *testing.T) {
prices := []cardsinfo.ScgCardPrice{}
result := formatCardPrices("_____", prices)
assert.Equal(t, "Оригинальное название: \\_\\_\\_\\_\\_\n\nЦен не найдено\n", result)
}