OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 library microlytics.test; | |
5 | |
6 import 'package:unittest/unittest.dart'; | |
ahe
2014/09/03 08:51:31
Still not a fan.
lukechurch
2014/09/04 12:58:42
Removed.
| |
7 import '../lib/microlytics.dart'; | |
8 import 'test_channel.dart'; | |
9 | |
10 void main() { | |
11 test('Basic event readtest', () { | |
12 TestChannel c = new TestChannel(); | |
13 AnalyticsLogger logger = new AnalyticsLogger( | |
14 c, | |
15 "2cfac780-31e2-11e4-8c21-0800200c9a66", | |
16 "UA-53895644-1", | |
17 "TestApp", | |
18 "0.42"); | |
19 logger.logAnonymousEvent("video", "play"); | |
20 expect(true, c.contains( | |
21 "v=1" | |
22 "&tid=UA-53895644-1" | |
23 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" | |
24 "&an=TestApp" | |
25 "&av=0.42" | |
26 "&t=event" | |
27 "&ec=video" | |
28 "&ea=play")); | |
29 }); | |
30 | |
31 test('Basic negative event readtest', () { | |
32 TestChannel c = new TestChannel(); | |
33 AnalyticsLogger logger = new AnalyticsLogger( | |
34 c, | |
35 "2cfac780-31e2-11e4-8c21-0800200c9a66", | |
36 "UA-53895644-1", | |
37 "TestApp", | |
38 "0.42"); | |
39 logger.logAnonymousEvent("video", "play"); | |
40 expect(false, c.contains( | |
41 "v=1" | |
42 "&tid=UA-53895644-1" | |
43 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" | |
44 "&an=TestApp" | |
45 "&av=XXX" | |
46 "&t=event" | |
47 "&ec=video" | |
48 "&ea=play")); | |
49 }); | |
50 | |
51 test('Basic timing readtest', () { | |
52 TestChannel c = new TestChannel(); | |
53 AnalyticsLogger logger = new AnalyticsLogger( | |
54 c, | |
55 "2cfac780-31e2-11e4-8c21-0800200c9a66", | |
56 "UA-53895644-1", | |
57 "TestApp", | |
58 "0.42"); | |
59 logger.logAnonymousTiming("video", "delay", 157); | |
60 expect(true, c.contains( | |
61 "v=1" | |
62 "&tid=UA-53895644-1" | |
63 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" | |
64 "&an=TestApp" | |
65 "&av=0.42" | |
66 "&t=timing" | |
67 "&utc=video" | |
68 "&utv=delay" | |
69 "&utt=157")); | |
70 }); | |
71 | |
72 test('Basic timing multi readtest', () { | |
73 TestChannel c = new TestChannel(); | |
74 AnalyticsLogger logger = new AnalyticsLogger( | |
75 c, | |
76 "2cfac780-31e2-11e4-8c21-0800200c9a66", | |
77 "UA-53895644-1", | |
78 "TestApp", | |
79 "0.42"); | |
80 logger.logAnonymousTiming("video", "delay", 159); | |
81 logger.logAnonymousTiming("video", "delay", 152); | |
82 expect(true, c.contains( | |
83 "v=1" | |
84 "&tid=UA-53895644-1" | |
85 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" | |
86 "&an=TestApp" | |
87 "&av=0.42" | |
88 "&t=timing" | |
89 "&utc=video" | |
90 "&utv=delay" | |
91 "&utt=152")); | |
92 expect(true, c.contains( | |
93 "v=1" | |
94 "&tid=UA-53895644-1" | |
95 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" | |
96 "&an=TestApp" | |
97 "&av=0.42" | |
98 "&t=timing" | |
99 "&utc=video" | |
100 "&utv=delay" | |
101 "&utt=159")); | |
102 expect(false, c.contains( | |
103 "v=1" | |
104 "&tid=UA-53895644-1" | |
105 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" | |
106 "&an=TestApp" | |
107 "&av=0.42" | |
108 "&t=timing" | |
109 "&utc=video" | |
110 "&utv=delay" | |
111 "&utt=19")); | |
112 }); | |
113 } | |
OLD | NEW |