github.com/projectdiscovery/nuclei/v2@v2.9.15/pkg/protocols/common/utils/excludematchers/excludematchers_test.go (about)

     1  package excludematchers
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestExcludeMatchers(t *testing.T) {
    10  	em := New([]string{"test-template:test-matcher", "new-template:*", "*:new-matcher", "only-template-id"})
    11  
    12  	require.True(t, em.Match("test-template", "test-matcher"), "could not get template-matcher value")
    13  	require.False(t, em.Match("test-template", "random-matcher"), "could get template-matcher value")
    14  
    15  	require.True(t, em.Match("new-template", "random-matcher"), "could not get template-matcher value wildcard")
    16  	require.True(t, em.Match("random-template", "new-matcher"), "could not get template-matcher value wildcard")
    17  
    18  	require.True(t, em.Match("only-template-id", "test"), "could not get only template id match value")
    19  }