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