-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPortal.test.ts
More file actions
44 lines (40 loc) · 1.19 KB
/
Copy pathPortal.test.ts
File metadata and controls
44 lines (40 loc) · 1.19 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
/*
* Javascript tests for Portals
*/
import { cb, platformUrl, mockRequest } from "./utils";
var portal: Portal;
beforeAll(function () {
portal = cb.Portal("fakePortal");
});
describe("ClearBlade Portals", function () {
it("fetches portal data", function () {
var callNum = mockRequest.mock.calls.length;
var expectedData = {
URI: platformUrl,
endpoint: "api/v/2/portals/fakeSystemKey/fakePortal",
method: "GET",
};
portal.fetch(function (err, data) {
expect(err).toBeNull();
expect(mockRequest.mock.calls[callNum][0]).toEqual(expectedData);
});
});
it("updates portal", function () {
var callNum = mockRequest.mock.calls.length;
var newData = {
name: "newFakePortalName",
};
var expectedData = {
URI: platformUrl,
endpoint: "api/v/2/portals/fakeSystemKey/fakePortal",
body: newData,
method: "PUT",
};
portal.update(newData, function (err, data) {
expect(err).toBeNull();
expect(mockRequest.mock.calls[callNum][0]).toEqual(expectedData);
});
});
});