Tests can have multiple env variables

This commit is contained in:
Mike Farah
2022-02-01 14:58:53 +11:00
parent 535799462f
commit 0afb59c65e
5 changed files with 65 additions and 58 deletions
+6 -6
View File
@@ -15,13 +15,13 @@ var evalOperatorScenarios = []expressionScenario{
},
},
{
description: "Dynamically update a path from an environment variable",
subdescription: "The env variable can be any valid yq expression.",
document: `{a: {b: [{name: dog}, {name: cat}]}}`,
environmentVariable: ".a.b[0].name",
expression: `eval(strenv(myenv)) = "cow"`,
description: "Dynamically update a path from an environment variable",
subdescription: "The env variable can be any valid yq expression.",
document: `{a: {b: [{name: dog}, {name: cat}]}}`,
environmentVariables: map[string]string{"pathEnv": ".a.b[0].name", "valueEnv": "moo"},
expression: `eval(strenv(pathEnv)) = strenv(valueEnv)`,
expected: []string{
"D0, P[], (doc)::{a: {b: [{name: cow}, {name: cat}]}}\n",
"D0, P[], (doc)::{a: {b: [{name: moo}, {name: cat}]}}\n",
},
},
}