forked from rusq/slackdump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser_test.go
33 lines (31 loc) · 879 Bytes
/
browser_test.go
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
32
33
package auth
import "testing"
func Test_sanitize(t *testing.T) {
type args struct {
workspace string
}
tests := []struct {
name string
args args
want string
wantErr bool
}{
{"not a URL", args{"blahblah"}, "blahblah", false},
{"url slash", args{"https://blahblah.slack.com/"}, "blahblah", false},
{"url no slash", args{"https://blahblah.slack.com"}, "blahblah", false},
{"url no schema slash", args{"blahblah.slack.com/"}, "blahblah", false},
{"url no schema no slash", args{"blahblah.slack.com"}, "blahblah", false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := sanitize(tt.args.workspace)
if (err != nil) != tt.wantErr {
t.Errorf("sanitize() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("sanitize() got = %v, want %v", got, tt.want)
}
})
}
}