-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivity_test.go
More file actions
28 lines (25 loc) · 936 Bytes
/
Copy pathactivity_test.go
File metadata and controls
28 lines (25 loc) · 936 Bytes
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
package tracker
import (
"reflect"
"testing"
)
func TestNewActivity(t *testing.T) {
tests := []struct {
name string
expected Activity
}{
{name: "iTerm2", expected: Activity{Name: "iTerm2", Category: categories["Development"]}},
{name: "http://localhost:3000", expected: Activity{Name: "localhost", Category: categories["Development"]}},
{name: "https://twitter.com", expected: Activity{Name: "twitter.com", Category: categories["Social"]}},
{name: "https://twitter.com?with=parsms&it=works&anyway=right", expected: Activity{Name: "twitter.com", Category: categories["Social"]}},
{name: "airmail", expected: Activity{Name: "airmail", Category: categories["Communication"]}},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
actual := NewActivity(test.name)
if !reflect.DeepEqual(actual, test.expected) {
t.Fatalf("Expected %v to equal %v", actual, test.expected)
}
})
}
}