diff --git a/functions/core/falsy_test.go b/functions/core/falsy_test.go index f10812ff..6edcca63 100644 --- a/functions/core/falsy_test.go +++ b/functions/core/falsy_test.go @@ -1,10 +1,11 @@ package core import ( + "testing" + "github.com/daveshanley/vacuum/model" "github.com/pb33f/libopenapi/utils" "github.com/stretchr/testify/assert" - "testing" ) func TestFalsy_RunRule_Fail(t *testing.T) { @@ -16,12 +17,15 @@ tags: - name: "non-falsy tag 2" description: 1 - name: "non-falsy tag 3" - description: "hello"` + description: "hello" + - name: "non-falsy tag 4" + description: + hello: goodbye` path := "$.tags[*]" nodes, _ := utils.FindNodes([]byte(sampleYaml), path) - assert.Len(t, nodes, 3) + assert.Len(t, nodes, 4) rule := buildCoreTestRule(path, model.SeverityError, "falsy", "description", nil) ctx := buildCoreTestContext(model.CastToRuleAction(rule.Then), nil) @@ -31,7 +35,7 @@ tags: tru := Falsy{} res := tru.RunRule(nodes, ctx) - assert.Len(t, res, 3) + assert.Len(t, res, 4) } func TestFalsy_RunRule_Fail_NoNodes(t *testing.T) { @@ -72,12 +76,14 @@ tags: - name: "falsy tag 3" description: "" - name: "falsy Tag 4" - description: "0"` + description: "0" + - name: "falsy Tag 5" + description:` path := "$.tags[*]" nodes, _ := utils.FindNodes([]byte(sampleYaml), path) - assert.Len(t, nodes, 4) + assert.Len(t, nodes, 5) rule := buildCoreTestRule(path, model.SeverityError, "Falsy", "description", nil) ctx := buildCoreTestContext(model.CastToRuleAction(rule.Then), nil)