Refactored test utils in VK module
This commit is contained in:
parent
d5f9a495b7
commit
121bb9fc9c
6 changed files with 124 additions and 112 deletions
31
internal/vk/test_info_fetcher.go
Normal file
31
internal/vk/test_info_fetcher.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package vk
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gitlab.com/flygrounder/go-mtg-vk/internal/cardsinfo"
|
||||
"io"
|
||||
)
|
||||
|
||||
type testInfoFetcher struct{}
|
||||
|
||||
func (t *testInfoFetcher) GetPrices(name string) ([]cardsinfo.CardPrice, error) {
|
||||
if name == "good" || name == "uncached" {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, errors.New("test")
|
||||
}
|
||||
|
||||
func (t *testInfoFetcher) FormatCardPrices(name string, _ []cardsinfo.CardPrice) string {
|
||||
return name
|
||||
}
|
||||
|
||||
func (t *testInfoFetcher) GetNameByCardId(_ string, _ string) string {
|
||||
return "good"
|
||||
}
|
||||
|
||||
func (t *testInfoFetcher) GetOriginalName(name string, _ io.Reader) string {
|
||||
if name == "good" || name == "bad" || name == "uncached" {
|
||||
return name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue