Skip to content

Commit

Permalink
fix[prod] single quote and double quote test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ankita-gulati-gojek committed Nov 6, 2023
1 parent 5128f11 commit 8a76cd2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions client/cmd/job/run_input_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package job_test

import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/goto/optimus/client/cmd/job"
)

func TestConstructConfigEnvSourcingContent(t *testing.T) {
t.Run("construct content with unsubstitude value", func(t *testing.T) {
config := map[string]string{
"EXAMPLE": "<no value>",
"ANOTHER": "hello",
}
content, keys := job.ConstructConfigEnvSourcingContent(config)
assert.Len(t, keys, 1)
assert.Contains(t, content, `EXAMPLE='<no value>'`)
assert.Contains(t, content, `ANOTHER='hello'`)
})
t.Run("construct content with single quote in it", func(t *testing.T) {
config := map[string]string{
"EXAMPLE": "value with 'single quote'",
"ANOTHER": "hello",
}
content, keys := job.ConstructConfigEnvSourcingContent(config)
assert.Len(t, keys, 0)
assert.Contains(t, content, `EXAMPLE='value with '\''single quote'\'''`)
assert.Contains(t, content, `ANOTHER='hello'`)
})
}

0 comments on commit 8a76cd2

Please sign in to comment.