Skip to content

Commit

Permalink
adding test case for empty default value
Browse files Browse the repository at this point in the history
Signed-off-by: Javan lacerda <javanlacerda@google.com>
  • Loading branch information
javanlacerda committed Aug 19, 2024
1 parent 0310e34 commit 9530aea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/identity/ciprovider/principal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func TestApplyTemplateOrReplace(t *testing.T) {
"url": "https://github.com",
"claim_foo": "default",
"default_foo": "default_bar",
"empty_value": "",
}

tests := map[string]struct {
Expand Down Expand Up @@ -309,6 +310,11 @@ func TestApplyTemplateOrReplace(t *testing.T) {
ExpectedResult: "bar",
ExpectErr: false,
},
`Should return empty string for empty default`: {
Template: "{{ .empty_value }}/123",
ExpectedResult: "/123",
ExpectErr: false,
},
}

for name, test := range tests {
Expand Down

0 comments on commit 9530aea

Please sign in to comment.