Skip to content

Commit 5893bd2

Browse files
yegor256CopilotCopilot
authored
new test for params.go (#139)
* test * Update internal/client/params_test.go Co-authored-by: Copilot <[email protected]> * Initial plan * Initial plan * Add edge case tests for mask function Co-authored-by: yegor256 <[email protected]> * Add missing test coverage for NewMockParams fields Co-authored-by: yegor256 <[email protected]> * Initial plan * Initial plan * Remove redundant variable in TestNewMockParams_DisablesStats Co-authored-by: yegor256 <[email protected]> * Remove TestMask tests from params_test.go Co-authored-by: yegor256 <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: yegor256 <[email protected]>
1 parent 45a1a23 commit 5893bd2

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

internal/client/params_test.go

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package client
2+
3+
import (
4+
"io"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
func TestNewMockParams_CreatesValidInstance(t *testing.T) {
12+
params := NewMockParams()
13+
require.NotNil(t, params, "params must not be nil")
14+
}
15+
16+
func TestNewMockParams_SetsMockProvider(t *testing.T) {
17+
params := NewMockParams()
18+
assert.Equal(t, "mock", params.Provider, "provider must be mock")
19+
}
20+
21+
func TestNewMockParams_SetsDefaultToken(t *testing.T) {
22+
params := NewMockParams()
23+
assert.Equal(t, "ABC", params.Token, "token must be ABC")
24+
}
25+
26+
func TestNewMockParams_EnablesMockProject(t *testing.T) {
27+
params := NewMockParams()
28+
assert.True(t, params.MockProject, "mock project must be enabled")
29+
}
30+
31+
func TestNewMockParams_DisablesDebug(t *testing.T) {
32+
params := NewMockParams()
33+
assert.False(t, params.Debug, "debug must be disabled")
34+
}
35+
36+
func TestNewMockParams_DisablesStats(t *testing.T) {
37+
assert.False(t, NewMockParams().Stats, "stats must be disabled")
38+
}
39+
40+
func TestNewMockParams_SetsStdFormat(t *testing.T) {
41+
params := NewMockParams()
42+
assert.Equal(t, "std", params.Format, "format must be std")
43+
}
44+
45+
func TestNewMockParams_SetsDefaultMaxSize(t *testing.T) {
46+
params := NewMockParams()
47+
assert.Equal(t, 200, params.MaxSize, "max size must be 200")
48+
}
49+
50+
func TestNewMockParams_SetsDiscardLog(t *testing.T) {
51+
params := NewMockParams()
52+
assert.Equal(t, io.Discard, params.Log, "log must be io.Discard")
53+
}
54+
55+
func TestNewMockParams_SetsDefaultChecks(t *testing.T) {
56+
params := NewMockParams()
57+
require.Equal(t, 1, len(params.Checks), "must have one check")
58+
assert.Equal(t, "mvn clean test", params.Checks[0], "check must be mvn clean test")
59+
}
60+
61+
func TestNewMockParams_DisablesColorless(t *testing.T) {
62+
params := NewMockParams()
63+
assert.False(t, params.Colorless, "colorless must be disabled")
64+
}
65+
66+
func TestNewMockParams_SetsDefaultModel(t *testing.T) {
67+
params := NewMockParams()
68+
assert.Equal(t, "gpt-3.5-turbo", params.Model, "model must be gpt-3.5-turbo")
69+
}
70+
71+
func TestNewMockParams_SetsDefaultAttempts(t *testing.T) {
72+
params := NewMockParams()
73+
assert.Equal(t, 3, params.Attempts, "attempts must be 3")
74+
}
75+
76+
func TestNewMockParams_SetsEmptyPlaybook(t *testing.T) {
77+
params := NewMockParams()
78+
assert.Equal(t, "", params.Playbook, "playbook must be empty")
79+
}
80+
81+
func TestNewMockParams_SetsStatsOutput(t *testing.T) {
82+
params := NewMockParams()
83+
assert.Equal(t, "stats", params.Soutput, "soutput must be stats")
84+
}
85+
86+
func TestNewMockParams_SetsEmptyInput(t *testing.T) {
87+
params := NewMockParams()
88+
assert.Equal(t, "", params.Input, "input must be empty")
89+
}
90+
91+
func TestNewMockParams_SetsEmptyOutput(t *testing.T) {
92+
params := NewMockParams()
93+
assert.Equal(t, "", params.Output, "output must be empty")
94+
}

0 commit comments

Comments
 (0)