-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
mock_test.go
57 lines (47 loc) · 991 Bytes
/
mock_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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package mixpanel
import (
"fmt"
"time"
)
var fullfillsInterface Mixpanel = &Mock{}
func ExampleMock() {
client := NewMock()
t, _ := time.Parse(time.RFC3339, "2016-03-03T15:17:53+01:00")
client.Update("1", &Update{
Operation: "$set",
Timestamp: &t,
IP: "127.0.0.1",
Properties: map[string]interface{}{
"custom_field": "cool!",
},
})
client.Track("1", "Sign Up", &Event{
IP: "1.2.3.4",
Properties: map[string]interface{}{
"from": "email",
},
})
client.Import("1", "Sign Up", &Event{
IP: "1.2.3.4",
Timestamp: &t,
Properties: map[string]interface{}{
"imported": true,
},
})
fmt.Println(client)
// Output:
// 1:
// ip: 127.0.0.1
// time: 2016-03-03T15:17:53+01:00
// properties:
// custom_field: cool!
// events:
// Sign Up:
// IP: 1.2.3.4
// Timestamp:
// from: email
// Sign Up:
// IP: 1.2.3.4
// Timestamp: 2016-03-03T15:17:53+01:00
// imported: true
}