MCPcopy Create free account
hub / github.com/daodst/chat / TestValidateConditionPositives

Function TestValidateConditionPositives

internal/pushrules/validate_test.go:144–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestValidateConditionPositives(t *testing.T) {
145 tsts := []struct {
146 Name string
147 Condition Condition
148 WantNoErrString string
149 }{
150 {"invalidKind", Condition{Kind: EventMatchCondition}, "invalid rule condition kind"},
151 }
152 for _, tst := range tsts {
153 t.Run(tst.Name, func(t *testing.T) {
154 errs := validateCondition(&tst.Condition)
155 for _, err := range errs {
156 t.Logf("Got error %#v", err)
157 if strings.Contains(err.Error(), tst.WantNoErrString) {
158 t.Errorf("errs: got %#v, want none containing %q", errs, tst.WantNoErrString)
159 }
160 }
161 })
162 }
163}

Callers

nothing calls this directly

Calls 3

validateConditionFunction · 0.85
RunMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected