Skip to content

Commit e75c48f

Browse files
deiningsagikazarmark
authored andcommitted
Fix issues reported by testifylint
1 parent a5ea569 commit e75c48f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/encoding/json/codec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestCodec_Encode(t *testing.T) {
5959
b, err := codec.Encode(data)
6060
require.NoError(t, err)
6161

62-
assert.Equal(t, encoded, string(b))
62+
assert.JSONEq(t, encoded, string(b))
6363
}
6464

6565
func TestCodec_Decode(t *testing.T) {

viper_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ func TestDefault(t *testing.T) {
477477
v.SetConfigType("yaml")
478478
err := v.ReadConfig(bytes.NewBuffer(yamlExample))
479479

480-
assert.NoError(t, err)
480+
require.NoError(t, err)
481481
assert.Equal(t, "leather", v.Get("clothing.jacket"))
482482
}
483483

@@ -1621,7 +1621,7 @@ func TestWrongDirsSearchNotFound(t *testing.T) {
16211621
v.AddConfigPath(`thispathaintthere`)
16221622

16231623
err := v.ReadInConfig()
1624-
assert.IsType(t, err, ConfigFileNotFoundError{"", ""})
1624+
assert.IsType(t, ConfigFileNotFoundError{"", ""}, err)
16251625

16261626
// Even though config did not load and the error might have
16271627
// been ignored by the client, the default still loads
@@ -1920,7 +1920,7 @@ func TestSafeWriteConfig(t *testing.T) {
19201920
require.NoError(t, v.SafeWriteConfig())
19211921
read, err := afero.ReadFile(fs, testutil.AbsFilePath(t, "/test/c.yaml"))
19221922
require.NoError(t, err)
1923-
assert.Equal(t, yamlWriteExpected, read)
1923+
assert.YAMLEq(t, string(yamlWriteExpected), string(read))
19241924
}
19251925

19261926
func TestSafeWriteConfigWithMissingConfigPath(t *testing.T) {
@@ -2501,7 +2501,7 @@ func TestKeyDelimiter(t *testing.T) {
25012501

25022502
var actual config
25032503

2504-
assert.NoError(t, v.Unmarshal(&actual))
2504+
require.NoError(t, v.Unmarshal(&actual))
25052505

25062506
assert.Equal(t, expected, actual)
25072507
}

0 commit comments

Comments
 (0)