2021-07-23 14:24:58 +00:00
|
|
|
package utils_test
|
|
|
|
|
|
|
|
import (
|
2021-10-30 03:24:53 +00:00
|
|
|
"jokes-bapak2-api/utils"
|
2021-07-23 14:24:58 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2021-08-04 05:56:14 +00:00
|
|
|
func TestIsIn_True(t *testing.T) {
|
2021-07-23 14:24:58 +00:00
|
|
|
arr := []string{"John", "Matthew", "Thomas", "Adam"}
|
2021-08-04 05:56:14 +00:00
|
|
|
check := utils.IsIn(arr, "Thomas")
|
|
|
|
if !check {
|
|
|
|
t.Error("check should be true: ", check)
|
|
|
|
}
|
|
|
|
}
|
2021-07-23 14:24:58 +00:00
|
|
|
|
2021-08-04 05:56:14 +00:00
|
|
|
func TestIsIn_False(t *testing.T) {
|
|
|
|
arr := []string{"John", "Matthew", "Thomas", "Adam"}
|
|
|
|
check := utils.IsIn(arr, "James")
|
|
|
|
if check {
|
|
|
|
t.Error("check should be false: ", check)
|
|
|
|
}
|
2021-08-03 18:15:35 +00:00
|
|
|
}
|