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

Function TestValidateActionNegatives

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

Source from the content-addressed store, hash-verified

69}
70
71func TestValidateActionNegatives(t *testing.T) {
72 tsts := []struct {
73 Name string
74 Action Action
75 WantErrString string
76 }{
77 {"emptyKind", Action{}, "invalid rule action kind"},
78 {"invalidKind", Action{Kind: ActionKind("something else")}, "invalid rule action kind"},
79 }
80 for _, tst := range tsts {
81 t.Run(tst.Name, func(t *testing.T) {
82 errs := validateAction(&tst.Action)
83 var foundErr error
84 for _, err := range errs {
85 t.Logf("Got error %#v", err)
86 if strings.Contains(err.Error(), tst.WantErrString) {
87 foundErr = err
88 }
89 }
90 if foundErr == nil {
91 t.Errorf("errs: got %#v, want containing %q", errs, tst.WantErrString)
92 }
93 })
94 }
95}
96
97func TestValidateActionPositives(t *testing.T) {
98 tsts := []struct {

Callers

nothing calls this directly

Calls 4

ActionKindTypeAlias · 0.85
validateActionFunction · 0.85
RunMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected