mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
Fix issues reported by testifylint
This commit is contained in:
parent
60e5c44537
commit
e1f6f8ddae
2 changed files with 5 additions and 5 deletions
|
@ -59,7 +59,7 @@ func TestCodec_Encode(t *testing.T) {
|
||||||
b, err := codec.Encode(data)
|
b, err := codec.Encode(data)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, encoded, string(b))
|
assert.JSONEq(t, encoded, string(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCodec_Decode(t *testing.T) {
|
func TestCodec_Decode(t *testing.T) {
|
||||||
|
|
|
@ -477,7 +477,7 @@ func TestDefault(t *testing.T) {
|
||||||
v.SetConfigType("yaml")
|
v.SetConfigType("yaml")
|
||||||
err := v.ReadConfig(bytes.NewBuffer(yamlExample))
|
err := v.ReadConfig(bytes.NewBuffer(yamlExample))
|
||||||
|
|
||||||
assert.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "leather", v.Get("clothing.jacket"))
|
assert.Equal(t, "leather", v.Get("clothing.jacket"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1621,7 +1621,7 @@ func TestWrongDirsSearchNotFound(t *testing.T) {
|
||||||
v.AddConfigPath(`thispathaintthere`)
|
v.AddConfigPath(`thispathaintthere`)
|
||||||
|
|
||||||
err := v.ReadInConfig()
|
err := v.ReadInConfig()
|
||||||
assert.IsType(t, err, ConfigFileNotFoundError{"", ""})
|
assert.IsType(t, ConfigFileNotFoundError{"", ""}, err)
|
||||||
|
|
||||||
// Even though config did not load and the error might have
|
// Even though config did not load and the error might have
|
||||||
// been ignored by the client, the default still loads
|
// been ignored by the client, the default still loads
|
||||||
|
@ -1920,7 +1920,7 @@ func TestSafeWriteConfig(t *testing.T) {
|
||||||
require.NoError(t, v.SafeWriteConfig())
|
require.NoError(t, v.SafeWriteConfig())
|
||||||
read, err := afero.ReadFile(fs, testutil.AbsFilePath(t, "/test/c.yaml"))
|
read, err := afero.ReadFile(fs, testutil.AbsFilePath(t, "/test/c.yaml"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, yamlWriteExpected, read)
|
assert.YAMLEq(t, string(yamlWriteExpected), string(read))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSafeWriteConfigWithMissingConfigPath(t *testing.T) {
|
func TestSafeWriteConfigWithMissingConfigPath(t *testing.T) {
|
||||||
|
@ -2501,7 +2501,7 @@ func TestKeyDelimiter(t *testing.T) {
|
||||||
|
|
||||||
var actual config
|
var actual config
|
||||||
|
|
||||||
assert.NoError(t, v.Unmarshal(&actual))
|
require.NoError(t, v.Unmarshal(&actual))
|
||||||
|
|
||||||
assert.Equal(t, expected, actual)
|
assert.Equal(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue