| 12345678910111213141516171819202122232425262728293031323334353637 |
- package utils_test
- import (
- "encoding/json"
- "testing"
- "github.com/porter-dev/porter/internal/templater"
- "github.com/porter-dev/porter/internal/templater/utils"
- )
- type testType struct {
- Value interface{} `json:"value,omitempty"`
- }
- func TestQueryValues(t *testing.T) {
- vals := map[string]interface{}{
- "testing": map[string]interface{}{
- "hello": "there",
- },
- }
- queries := make([]*templater.TemplateReaderQuery, 0)
- query, _ := utils.NewQuery("test", `{ .testing }`)
- queries = append(queries, query)
- res, _ := utils.QueryValues(vals, queries)
- test := &testType{
- Value: res["test"],
- }
- bytes, _ := json.Marshal(test)
- t.Errorf(string(bytes))
- }
|