github.com/grokify/go-ringcentral-client@v0.3.31/office/v1/util/glip_test.go (about) 1 package clientutil 2 3 import ( 4 "testing" 5 ) 6 7 var fuzzyAtMentionTests = []struct { 8 inputName string 9 inputText string 10 expected bool 11 }{ 12 {`glipbot`, ` @glipbot hello world!`, true}, 13 {`glipbot`, ` hello world! @glipbot `, true}, 14 {`glipbot`, `hello world!`, false}, 15 {`glipbot`, `@glipdog hello world`, false}, 16 {` GLIPBOT `, ` @GlipBot hello world!`, true}, 17 {` GLIPBOT `, ` @glipbot hello world!`, true}} 18 19 func TestIsAtMentionedFuzzy(t *testing.T) { 20 for _, tt := range fuzzyAtMentionTests { 21 match := IsAtMentionedFuzzy(tt.inputName, tt.inputText) 22 23 if match != tt.expected { 24 t.Errorf("clientutil.IsAtMentionedFuzzy error: name[%v] text[%v] result[%v] expected [%v]", tt.inputName, tt.inputText, match, tt.expected) 25 } 26 } 27 }