Fix validation of Page Kind in cascade target map

Fixes #8888
This commit is contained in:
Joe Mooring
2022-01-29 18:34:27 -08:00
committed by Bjørn Erik Pedersen
parent a7d182cea1
commit d1109f590a
3 changed files with 18 additions and 6 deletions

View File

@@ -54,7 +54,12 @@ func TestPageMatcher(t *testing.T) {
c.Run("Decode", func(c *qt.C) {
var v PageMatcher
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "foo"}, &v), qt.Not((qt.IsNil)))
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "foo"}, &v), qt.Not(qt.IsNil))
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "{foo,bar}"}, &v), qt.Not(qt.IsNil))
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "taxonomy"}, &v), qt.IsNil)
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "{taxonomy,foo}"}, &v), qt.IsNil)
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "{taxonomy,term}"}, &v), qt.IsNil)
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "*"}, &v), qt.IsNil)
c.Assert(DecodePageMatcher(map[string]interface{}{"kind": "home", "path": filepath.FromSlash("/a/b/**")}, &v), qt.IsNil)
c.Assert(v, qt.Equals, PageMatcher{Kind: "home", Path: "/a/b/**"})
})