pinter-u-krovu-bot/chatbot/chatbot_test.go
2024-10-03 16:19:54 +02:00

96 lines
1.6 KiB
Go

package chatbot
import (
"testing"
)
func TestNekoUKrovuBot_checkForJelNekoUKrovu(t *testing.T) {
type args struct {
txt string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "matches 'jel neko u krovu'",
args: args{
txt: "jel neko u krovu",
},
want: true,
},
{
name: "matches 'ima li koga na krovu'",
args: args{
txt: "ima li koga na krovu",
},
want: true,
},
{
name: "does not match 'nema nikoga'",
args: args{
txt: "nema nikoga",
},
want: false,
},
{
name: "matches 'koga ima na krovu'",
args: args{
txt: "koga ima na krovu",
},
want: true,
},
{
name: "matches 'neko u krov'",
args: args{
txt: "neko u krov",
},
want: true,
},
{
name: "case insensitive match 'EL NEKO krov'",
args: args{
txt: "EL NEKO krov",
},
want: true,
},
{
name: "case insensitive match 'jel neko jebeno u krovu'",
args: args{
txt: "jel neko jebeno u krovu",
},
want: true,
},
{
name: "case insensitive match 'buraz jel neko jebeno u krovu'",
args: args{
txt: "buraz jel neko jebeno u krovu",
},
want: true,
},
{
name: "case insensitive match 'neko u krovu?'",
args: args{
txt: "neko u krovu?",
},
want: true,
},
{
name: "case insensitive match 'u krovu?'",
args: args{
txt: "u krovu?",
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
nkbot := &NekoUKrovuBot{}
if got := nkbot.checkForJelNekoUKrovu(tt.args.txt); got != tt.want {
t.Errorf("NekoUKrovuBot.checkForJelNekoUKrovu() = %v, want %v", got, tt.want)
}
})
}
}