forked from ClearBlade/JavaScript-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeSpec.js
More file actions
31 lines (30 loc) · 787 Bytes
/
CodeSpec.js
File metadata and controls
31 lines (30 loc) · 787 Bytes
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
/*
* JavaScript tests to test the code functionality
*/
describe("ClearBlade code", function() {
it("executes given code service with params", function () {
var code = cb.Code()
var callNum = ClearBlade.request.calls.count() // we need this for later
var params = {
name: 'charlie',
age: 23
};
var expectedData = {
method: 'POST',
endpoint: 'api/v/1/code/fakeSystemKey/fakeCodeService',
URI: undefined,
body: {
name: 'charlie',
age: 23
},
user: {
email: '[email protected]',
authToken: 'testUserToken'
}
};
code.execute('fakeCodeService', params, function (err, data) {
expect(err).toBeNull();
expect(ClearBlade.request.calls.argsFor(callNum)[0]).toEqual(expectedData);
});
});
});