-
Notifications
You must be signed in to change notification settings - Fork 13
/
server-tests.js
63 lines (60 loc) · 1.55 KB
/
server-tests.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
/*
* mondora:connect-with - registers the `addLoginService` method
*/
Tinytest.add("mondora:connect-with - registers the `addLoginService` method", function (test) {
var methods = _.keys(Meteor.server.method_handlers);
test.isTrue(_.contains(methods, "addLoginService"));
});
/*
* mondora:connect-with - registers the `listLoginServices` method
*/
Tinytest.add("mondora:connect-with - registers the `listLoginServices` method", function (test) {
var methods = _.keys(Meteor.server.method_handlers);
test.isTrue(_.contains(methods, "listLoginServices"));
});
/*
* Setup methods
*/
var pendingCredential = {
"_id": "1234",
"key": "1234",
"credential": {
"serviceName": "google",
"serviceData": {
"accessToken": "1234",
"expiresAt": 1500000000000,
"id": "1234",
"email": "[email protected]",
"verified_email": true,
"name": "Paolo Scanferla",
"given_name": "Paolo",
"family_name": "Scanferla",
"picture": "http://goo.gl/UEjSp8",
"locale": "en",
"gender": "male"
},
"options": {
"profile": {
"name": "Paolo Scanferla"
}
}
},
"credentialSecret": "1234",
"createdAt": "2014-01-01T00:00:00.000Z"
};
Meteor.methods({
addUser: function () {
Meteor.users.remove({});
Accounts.createUser({
username: "pscanf",
password: "pscanf"
});
},
addPendingCredentials: function () {
OAuth._pendingCredentials.remove({});
OAuth._pendingCredentials.insert(pendingCredential);
},
checkServiceData: function () {
return _.isEqual(Meteor.user().services.google, pendingCredential.credential.serviceData);
}
});