Refactored test utils in VK module
This commit is contained in:
parent
d5f9a495b7
commit
121bb9fc9c
6 changed files with 124 additions and 112 deletions
19
internal/vk/test_cache.go
Normal file
19
internal/vk/test_cache.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package vk
|
||||
|
||||
import "errors"
|
||||
|
||||
type testCache struct {
|
||||
table map[string]string
|
||||
}
|
||||
|
||||
func (t *testCache) Get(cardName string) (string, error) {
|
||||
msg, ok := t.table[cardName]
|
||||
if !ok {
|
||||
return "", errors.New("test")
|
||||
}
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
func (t *testCache) Set(cardName string, message string) {
|
||||
t.table[cardName] = message
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue