Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduchesne committed Aug 4, 2023
1 parent c5c02ab commit e356d0b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/tanka/evaluators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ func TestEvalJsonnet(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, `"foovalue"`, strings.TrimSpace(json))
}

func TestEvalJsonnetWithExpression(t *testing.T) {
exprs := []string{`["testCase"]`, "testCase"}

for _, expr := range exprs {
t.Run(expr, func(t *testing.T) {
opts := jsonnet.Opts{
EvalScript: PatternEvalScript(expr),
}

// This will fail intermittently if TLAs are passed as positional
// parameters.
json, err := evalJsonnet("testdata/cases/object", opts)
assert.NoError(t, err)
assert.Equal(t, `"object"`, strings.TrimSpace(json))
})
}
}

0 comments on commit e356d0b

Please sign in to comment.