forked from ClearBlade/JavaScript-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalytics.test.ts
More file actions
87 lines (80 loc) · 2.57 KB
/
Analytics.test.ts
File metadata and controls
87 lines (80 loc) · 2.57 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* Javascript tests for Analytics
*/
import { cb, platformUrl } from "./utils";
var analytics: Analytics;
beforeAll(function() {
analytics = cb.Analytics();
});
describe("ClearBlade Analytics", function() {
it("gets storage data", function() {
var callNum = ClearBlade.request.mock.calls.length;
var expectedData = {
URI: platformUrl,
endpoint: "api/v/2/analytics/storage",
method: "GET",
qs: "query={}",
};
analytics.getStorage({}, function(err, data) {
expect(err).toBeNull();
expect(ClearBlade.request.mock.calls[callNum][0]).toEqual(expectedData);
});
});
it("gets count", function() {
var callNum = ClearBlade.request.mock.calls.length;
var expectedData = {
URI: platformUrl,
endpoint: "api/v/2/analytics/count",
method: "GET",
qs: "query={}",
};
analytics.getCount({}, function(err, data) {
expect(err).toBeNull();
expect(ClearBlade.request.mock.calls[callNum][0]).toEqual(expectedData);
});
});
it("gets event list", function() {
var callNum = ClearBlade.request.mock.calls.length;
var expectedData = {
URI: platformUrl,
endpoint: "api/v/2/analytics/eventlist",
method: "GET",
qs: "query={}",
};
analytics.getEventList({}, function(err, data) {
expect(err).toBeNull();
expect(ClearBlade.request.mock.calls[callNum][0]).toEqual(expectedData);
});
});
it("gets event totals", function() {
var callNum = ClearBlade.request.mock.calls.length;
var expectedData = {
URI: platformUrl,
endpoint: "api/v/2/analytics/eventtotals",
method: "GET",
qs: "query={}",
};
analytics.getEventTotals({}, function(err, data) {
expect(err).toBeNull();
expect(ClearBlade.request.mock.calls[callNum][0]).toEqual(expectedData);
});
});
it("gets user events", function() {
var callNum = ClearBlade.request.mock.calls.length;
var expectedData = {
URI: platformUrl,
endpoint: "api/v/2/analytics/userevents",
method: "GET",
qs: "query={}",
};
analytics.getUserEvents({}, function(err, data) {
expect(err).toBeNull();
expect(ClearBlade.request.mock.calls[callNum][0]).toEqual(expectedData);
});
});
});