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