function isRenderCallExpression( node ) { if ( 'CallExpression' !== node.type ) { return false; } let calleeName; if ( 'MemberExpression' === node.callee.type ) { calleeName = node.callee.property.name; } else if ( 'Identifier' === node.callee.type ) { calleeName = node.callee.name; } return calleeName && 'render' === calleeName; }
util.request({ method: 'put', url: 'https://auth.test.whistlejs.com/index2.html' }, function(res, data) { data.headers.should.have.property('authorization'); });
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]); });
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); }); }); });
util.request('http://raw.test.whistlejs.com/index.html?doNotParseJson', function(res, body) { res.statusCode.should.equal(500); body.should.equal('test'); res.headers.should.have.property('content-type', 'text/plain'); });
util.request({ method: 'post', headers: { 'x-delete-test': 123 }, url: 'http://delete1.test.whistlejs.com/index.html?post' }, function(res, data) { data.headers.should.have.property('x-delete-test'); data.headers.should.have.property('x-delete-all'); data.headers.should.have.property('x-delete-req'); res.headers.should.have.property('x-delete-res'); });
util.request({ url: 'http://pac.test.com/index.html', method: 'post' }, function(res, data) { data.should.be.have.property('type', 'server'); });
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'); }); }); });
util.request({ method: 'post', url: 'https://reqcors.test.whistlejs.com/index.html' }, function(res, data) { data.headers.should.have.property('origin', '*'); data.headers.should.have.property('access-control-request-method', 'POST'); data.headers.should.have.property('access-control-request-headers', 'x-test'); });
util.request({ url: 'https://filter.com/index.html', method: 'delete', body: 'test', headers: { 'test': 'abc' } }, function(res, data) { data.should.have.property('ec', 1); });
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('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'); }); }); });
util.request({ url: 'https://filter.com/index.html', method: 'post', body: '555555', headers: { 'test': 'abc', 'x-test': 'abc' } }, function(res, data) { data.should.have.property('ec', 2); });
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); }); }); });