mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
40 lines
637 B
Go
40 lines
637 B
Go
|
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
|
||
|
request = mockCommandsUsed(53)
|
||
|
response = 180
|
||
|
|
||
|
got = request
|
||
|
want = response
|
||
|
|
||
|
if got != want {
|
||
|
t.Errorf("got %v, want %v", got, want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func mockCommandsUsed(n int) int {
|
||
|
for i := 0; i < n; i++ {
|
||
|
CommandUsed()
|
||
|
}
|
||
|
return tempCommands
|
||
|
}
|