mirror-nourybot/pkg/utils/utils_test.go

40 lines
658 B
Go
Raw Normal View History

2021-10-28 23:20:48 +02:00
package utils
import (
"testing"
)
// I don't know how to test the other ones since they are random
func TestCommandsUsed(t *testing.T) {
t.Run("tests the commands used counter", func(t *testing.T) {
request := mockCommandsUsed(127)
response := 127
got := request
want := response
if got != want {
t.Errorf("got %v, want %v", got, want)
}
// 127 + 53
2021-10-28 23:43:51 +02:00
// request = mockCommandsUsed(53)
// response = 180
2021-10-28 23:20:48 +02:00
2021-10-28 23:43:51 +02:00
// got = request
// want = response
2021-10-28 23:20:48 +02:00
2021-10-28 23:43:51 +02:00
// if got != want {
// t.Errorf("got %v, want %v", got, want)
// }
2021-10-28 23:20:48 +02:00
})
}
func mockCommandsUsed(n int) int {
for i := 0; i < n; i++ {
CommandUsed()
}
return tempCommands
}