-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathminimax_cfg_test.go
More file actions
44 lines (35 loc) · 1.06 KB
/
minimax_cfg_test.go
File metadata and controls
44 lines (35 loc) · 1.06 KB
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
package cfg
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMiniMaxBaseURL_Default(t *testing.T) {
os.Unsetenv("MINIMAX_BASE_URL")
url := miniMaxBaseURL()
assert.Equal(t, "https://api.minimax.io/v1", url)
}
func TestMiniMaxBaseURL_Custom(t *testing.T) {
os.Setenv("MINIMAX_BASE_URL", "https://custom.minimax.io/v1")
defer os.Unsetenv("MINIMAX_BASE_URL")
url := miniMaxBaseURL()
assert.Equal(t, "https://custom.minimax.io/v1", url)
}
func TestCfg_MiniMaxFields(t *testing.T) {
os.Setenv("MINIMAX_API_KEY", "test-minimax-key")
os.Setenv("MINIMAX_BASE_URL", "https://test.minimax.io/v1")
defer func() {
os.Unsetenv("MINIMAX_API_KEY")
os.Unsetenv("MINIMAX_BASE_URL")
}()
c := GetCfg()
assert.Equal(t, "test-minimax-key", c.MiniMaxAPIKey)
assert.Equal(t, "https://test.minimax.io/v1", c.MiniMaxBaseURL)
}
func TestCfg_MiniMaxFieldsEmpty(t *testing.T) {
os.Unsetenv("MINIMAX_API_KEY")
os.Unsetenv("MINIMAX_BASE_URL")
c := GetCfg()
assert.Empty(t, c.MiniMaxAPIKey)
assert.Equal(t, "https://api.minimax.io/v1", c.MiniMaxBaseURL)
}