Skip to content

Commit

Permalink
Fix up config test (#621)
Browse files Browse the repository at this point in the history
Make code more readable by replacing overly generic `trueValue` with the
actual meaning `marshalSecret`.

Fixes: #487

Signed-off-by: SuperQ <superq@gmail.com>
  • Loading branch information
SuperQ authored Apr 15, 2024
1 parent de5ed88 commit c1b9b72
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func TestJSONMarshalSecret(t *testing.T) {
S Secret
}
for _, tc := range []struct {
desc string
data tmp
expected string
trueValue bool
testYAML bool
desc string
data tmp
expected string
marshalSecret bool
testYAML bool
}{
{
desc: "inhabited",
Expand All @@ -42,18 +42,18 @@ func TestJSONMarshalSecret(t *testing.T) {
expected: "{\"S\":\"\\u003csecret\\u003e\"}",
},
{
desc: "true value in JSON",
data: tmp{"test"},
expected: `{"S":"test"}`,
trueValue: true,
desc: "true value in JSON",
data: tmp{"test"},
expected: `{"S":"test"}`,
marshalSecret: true,
},
{
desc: "true value in YAML",
data: tmp{"test"},
expected: `s: test
`,
trueValue: true,
testYAML: true,
marshalSecret: true,
testYAML: true,
},
{
desc: "empty",
Expand All @@ -62,7 +62,7 @@ func TestJSONMarshalSecret(t *testing.T) {
},
} {
t.Run(tc.desc, func(t *testing.T) {
MarshalSecretValue = tc.trueValue
MarshalSecretValue = tc.marshalSecret

var marshalFN func(any) ([]byte, error)
if tc.testYAML {
Expand Down

0 comments on commit c1b9b72

Please sign in to comment.