From a26f9c261bb5ec71a54d97c5868edc092140bafd Mon Sep 17 00:00:00 2001 From: YEVHENII SHCHERBINA Date: Fri, 9 Jan 2026 17:44:57 +0000 Subject: [PATCH] test: add few minor tests --- rulesengine/parse_and_match_test.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/rulesengine/parse_and_match_test.go b/rulesengine/parse_and_match_test.go index b0bc2fa3..02efdfca 100644 --- a/rulesengine/parse_and_match_test.go +++ b/rulesengine/parse_and_match_test.go @@ -265,13 +265,37 @@ func TestRoundTripExtraRules(t *testing.T) { expectMatch: true, }, { - name: "complex scenario 1", + name: "wildcard symbol at the end of path", rules: []string{"method=GET,POST,PUT domain=github.com path=/api/issues/*"}, - url: "https://github.com:8080/api/issues/123/edit", + url: "https://github.com/api/issues/123/edit", method: "POST", expectParse: true, expectMatch: true, }, + { + name: "wildcard symbol at the end of path doesn't match base path", + rules: []string{"method=GET domain=github.com path=/api/issues/*"}, + url: "https://github.com/api/issues", + method: "GET", + expectParse: true, + expectMatch: false, + }, + { + name: "includes all subdomains by default", + rules: []string{"domain=github.com"}, + url: "https://x.users.api.github.com", + method: "GET", + expectParse: true, + expectMatch: true, + }, + { + name: "domain wildcard in the middle matches exactly one label", + rules: []string{"domain=api.*.com"}, + url: "https://api.v1.github.com", + method: "POST", + expectParse: true, + expectMatch: false, + }, } logHandler := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{