This repository has been archived by the owner on Nov 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest.js
68 lines (58 loc) · 1.74 KB
/
test.js
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
var outbound = require("./outbound.js");
var ob = new outbound("bf6af822c410b56807abfafa42e67d95");
/*
The only things we want to test are to ensure we are forcing user IDs and event
as the proper types. User IDs must be string or number and events must be strings.
We don't need a success callback because the HTTP calls will always fail triggering
an error.
*/
console.log("Testing identify call.");
ob.identify([1,2]).error(
function(err) {
if (err.receivedCall) {
console.log("[FAIL - identify] Should have recieved bad user ID error.");
}
}
);
console.log("Testing track call.");
ob.track([1,2], "1").error(
function(err) {
if (err.receivedCall) {
console.log("[FAIL - track] Should have recieved bad user ID error.");
}
}
);
ob.track(1, 1).error(
function(err) {
if (err.receivedCall) {
console.log("[FAIL - track] Should have recieved bad event error.");
}
}
);
console.log("Testing register token.");
ob.registerApnsToken([1,2], "token").error(
function(err) {
if (err.receivedCall) {
console.log("[FAIL - register] Should have received bad user ID error.");
}
}
);
ob.registerApnsToken(1, ["token"]).error(
function(err) {
if (err.receivedCall) {
console.log("[FAIL - register] Should have received bad token error.");
}
}
);
ob.registerApnsToken("travis", "token").then(
function() {
console.log("all good in the hood");
},
function(err) {
console.log(err);
if (!err.receivedCall) {
console.log("[FAIL - register] Should have received bad token error.");
}
}
);
setTimeout(function() {console.log("done waiting");}, 5000);