From a4eda80d29dc4932edbef60a6086a3dd9922df20 Mon Sep 17 00:00:00 2001 From: Liz Rice Date: Wed, 23 Oct 2019 16:21:40 +0100 Subject: [PATCH] Add more constraint-matching test cases --- check/check_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/check/check_test.go b/check/check_test.go index d461361..73df517 100644 --- a/check/check_test.go +++ b/check/check_test.go @@ -149,6 +149,30 @@ func TestGetFirstValidSubCheck(t *testing.T) { }, }, }, + { + // Should match if there are no constraints on the test at all + Expected: true, + SubChecks: []*SubCheck{ + { + BaseCheck{ + Constraints: map[string][]string{}, + Remediation: "Expected", + }, + }, + }, + }, + { + // Should not match if there are constraints on the test that aren't defined for this run + Expected: false, + SubChecks: []*SubCheck{ + { + BaseCheck{ + Constraints: map[string][]string{"something": []string{"not", "defined"}}, + Remediation: "Expected", + }, + }, + }, + }, } for ii, testCase := range testCases {