describe("form_onReset", () => { it("hides any error text being shown", () => { const gotoTimeView = new GotoTimeView(options); gotoTimeView.form.emit("reset"); expect(gotoTimeView.errorText.hide).to.have.been.calledOnce; }); });
it("should update series without exceeding limit", () => { options.layoutConfig.view.limit = 3; options.series.high = { highwater: true }; const baseGraph = new BaseLineGraph(options); baseGraph.update({ a: 27, high: 27 }); expect(baseGraph).to.have.nested.property("series.a.y").that.deep.equals([0, 0, 27]); expect(baseGraph).to.have.nested.property("series.high.y").that.deep.equals([27, 27, 27]); });
it('should failed if no CALDAV_URL', async () => { configEnv.gladys.variable.getValue .withArgs('CALDAV_URL', '5d6c666f-56be-4929-9104-718a78556844', userId) .returns(undefined); configEnv.gladys.variable.getValue .withArgs('CALDAV_USERNAME', '5d6c666f-56be-4929-9104-718a78556844', userId) .returns('tony'); configEnv.gladys.variable.getValue .withArgs('CALDAV_PASSWORD', '5d6c666f-56be-4929-9104-718a78556844', userId) .returns('12345'); await expect(configEnv.config(userId)).to.be.rejectedWith(Error, 'MISSING_PARAMETERS'); });
describe("acceptButton_onKey_escape", () => { it("presses the cancel button programmatically", () => { // to make the screen act like a real event emitter, set stubEvents to false // and create a new testContainer createTestContainer(false); const gotoTimeView = new GotoTimeView(options); gotoTimeView.acceptButton.focus(); gotoTimeView.screen.program.emit("keypress", "escape", { full: "escape" }); expect(gotoTimeView.cancelButton.press).to.have.been.calledOnce; }); });
describe("hide", () => { it("hides the popup and restores focus", () => { const gotoTimeView = new GotoTimeView(options); gotoTimeView.hide(); expect(gotoTimeView.node.hide).to.have.been.calledOnce; expect(gotoTimeView.screen.restoreFocus).to.have.been.calledOnce; expect(gotoTimeView.screen.render).to.have.been.calledOnce; }); });
describe('POST /api/v1/session/api_key', () => { it('should create api key', async () => { await authenticatedRequest .post('/api/v1/session/api_key') .expect('Content-Type', /json/) .expect(201) .then((res) => { expect(res.body).to.have.property('api_key'); expect(res.body).to.have.property('session_id'); }); }); });
describe('server listening', () => { it('should be listening', async () => { require('../server.js'); const isOpen = await waitPort({port: 8080}); expect(isOpen).to.be.true; }); });
describe("toggle", () => { it("toggles the visibility of the popup", () => { const gotoTimeView = new GotoTimeView(options); gotoTimeView.toggle(); expect(gotoTimeView.node.toggle).to.have.been.calledOnce; }); });
describe('#logs', () => { it('should return the correct default options when not specified'); it('#logs should return an object.', () => { const logsResult = compose.logs(['string1', 'string2'], 'my_project', {'pull': true}); expect(logsResult).to.be.an('object'); }); });
describe('DELETE /api/v1/calendar/:calendar_selector', () => { it('should delete a calendar', async () => { await authenticatedRequest .delete('/api/v1/calendar/test-calendar') .expect('Content-Type', /json/) .expect(200) .then((res) => { expect(res.body).to.have.property('success', true); }); }); });
describe('GET /api/v1/system/info', () => { it('should return system infos', async () => { await authenticatedRequest .get('/api/v1/system/info') .expect('Content-Type', /json/) .expect(200) .then((res) => { expect(res.body).to.have.property('platform'); expect(res.body).to.have.property('nodejs_version'); }); }); });
describe('POST /api/v1/house/:user_selector/user/:user_selector/seen', () => { it('should mark the user has seen in this house', async () => { await authenticatedRequest .post('/api/v1/house/test-house/user/john/seen') .expect('Content-Type', /json/) .expect(200) .then((res) => { expect(res.body).to.have.property('current_house_id', 'a741dfa6-24de-4b46-afc7-370772f068d5'); }); }); });
describe('DELETE /api/v1/device/:device_selector', () => { it('should delete device', async () => { await authenticatedRequest .delete('/api/v1/device/test-device') .expect('Content-Type', /json/) .expect(200) .then((res) => { expect(res.body).to.have.property('success', true); }); }); });