-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmock.go
55 lines (43 loc) · 1.22 KB
/
mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package discordgoi18n
import (
"github.com/bwmarrin/discordgo"
"github.com/rs/zerolog/log"
)
func newMock() *translatorMock {
return &translatorMock{}
}
func (mock *translatorMock) SetDefault(locale discordgo.Locale) {
if mock.SetDefaultFunc != nil {
mock.SetDefaultFunc(locale)
return
}
log.Warn().Msgf("SetDefault not mocked")
}
func (mock *translatorMock) LoadBundle(locale discordgo.Locale, file string) error {
if mock.LoadBundleFunc != nil {
return mock.LoadBundleFunc(locale, file)
}
log.Warn().Msgf("LoadBundle not mocked")
return nil
}
func (mock *translatorMock) Get(locale discordgo.Locale, key string, variables Vars) string {
if mock.GetFunc != nil {
return mock.GetFunc(locale, key, variables)
}
log.Warn().Msgf("Get not mocked")
return ""
}
func (mock *translatorMock) GetDefault(key string, variables Vars) string {
if mock.GetDefaultFunc != nil {
return mock.GetDefaultFunc(key, variables)
}
log.Warn().Msgf("GetDefault not mocked")
return ""
}
func (mock *translatorMock) GetLocalizations(key string, variables Vars) *map[discordgo.Locale]string {
if mock.GetFunc != nil {
return mock.GetLocalizationsFunc(key, variables)
}
log.Warn().Msgf("GetLocalizations not mocked")
return nil
}