mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-19 01:45:25 +00:00
* Adding unexpected fields validation * using expected fields * adding missing expected field * using reflect
19 lines
408 B
Go
19 lines
408 B
Go
package matchers
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestValidate(t *testing.T) {
|
|
m := &Matcher{matcherType: DSLMatcher, DSL: []string{"anything"}}
|
|
|
|
err := m.Validate()
|
|
require.Nil(t, err, "Could not validate correct template")
|
|
|
|
m = &Matcher{matcherType: DSLMatcher, Part: "test"}
|
|
err = m.Validate()
|
|
require.NotNil(t, err, "Invalid template was correctly validated")
|
|
}
|