blob: b8d4315f85a8ec5f12c04a990f82111388efed04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package main
import (
"reflect"
"testing"
)
func mockWebsiteChecker(url string) bool {
if url == "https://www.example.com" {
return false
}
return true
}
func TestCheckWebsites(t *testing.T) {
websites := []string{
"https://www.google.com",
"https://www.example.com",
}
want := map[string]bool{
"https://www.google.com": true,
"https://www.example.com": false,
}
got := CheckWebsites(mockWebsiteChecker, websites)
if !reflect.DeepEqual(want, got) {
t.Fatalf("Wanted %v got %v", want, got)
}
}
|