Skip to content

Commit dd453ba

Browse files
committed
add test for regex
1 parent fb1071e commit dd453ba

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/scout/scout_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ func TestScoutWithMapping(t *testing.T) {
6767
})
6868
}
6969

70+
func TestScoutWithRegex(t *testing.T) {
71+
is := is.New(t)
72+
73+
t.Run("instantiation", func(t *testing.T) {
74+
s := New("b.r", jsonMapping(), true)
75+
is.Equal(reflect.TypeOf(s).String(), "scout.Scout")
76+
})
77+
78+
t.Run("finds wildcard value", func(t *testing.T) {
79+
s := New("b.r", jsonMapping(), true)
80+
found, err := s.DoSearch()
81+
is.NoErr(err)
82+
83+
is.Equal(len(found), 1)
84+
is.Equal(found[0], ".foo")
85+
})
86+
}
87+
7088
func jsonArray() []any {
7189
in := []byte(`
7290
[{

0 commit comments

Comments
 (0)