47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
describe('App Module', function() {
|
|
|
|
before(() => {
|
|
return Edge.connect();
|
|
});
|
|
|
|
after(() => {
|
|
Edge.disconnect();
|
|
});
|
|
|
|
it('should list apps', function() {
|
|
return Edge.rpc("listApps")
|
|
.then(apps => {
|
|
console.log("listApps result:", apps);
|
|
chai.assert.isNotNull(apps);
|
|
chai.assert.isAtLeast(apps.length, 1);
|
|
})
|
|
});
|
|
|
|
it('should retrieve requested app', function() {
|
|
return Edge.rpc("getApp", { appId: "edge.sdk.client.test" })
|
|
.then(app => {
|
|
console.log("getApp result:", app);
|
|
chai.assert.isNotNull(app);
|
|
chai.assert.equal(app.id, "edge.sdk.client.test");
|
|
})
|
|
});
|
|
|
|
it('should retrieve requested app url without from address', function() {
|
|
return Edge.rpc("getAppUrl", { appId: "edge.sdk.client.test" })
|
|
.then(url => {
|
|
console.log("getAppUrl result:", url);
|
|
chai.assert.isNotEmpty(url);
|
|
chai.assert.match(url, /^http:\/\/0\.0\.0\.0/)
|
|
})
|
|
});
|
|
|
|
it('should retrieve requested app url with from address', function() {
|
|
return Edge.rpc("getAppUrl", { appId: "edge.sdk.client.test", from: "127.0.0.2" })
|
|
.then(url => {
|
|
console.log("getAppUrl result:", url);
|
|
chai.assert.isNotEmpty(url);
|
|
chai.assert.match(url, /^http:\/\/127\.0\.0\.1/)
|
|
})
|
|
});
|
|
|
|
}); |