it("should return an error when pusage fails", (done) => { sandbox.stub(pusage, "stat").yields(new Error("bad error")); agent._getStats((err, metrics) => { tryCatch(done, () => { expect(err).to.exist; expect(metrics).to.be.undefined; expect(err.message).to.equal("bad error"); }); }); });
describe('server listening', () => { it('should be listening', async () => { require('../server.js'); const isOpen = await waitPort({port: 8080}); expect(isOpen).to.be.true; }); });
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('#Landerode', () => { it('should inherit things from Dockerode', () => { expect(Landerode.prototype).to.be.an.instanceOf(Dockerode); }); });
it('can be trained', () => { const recognizer = createFaceRecognizer() const trainFaces = loadTrainFaces() recognizer.addFaces(trainFaces.sheldon, 'sheldon') recognizer.addFaces(trainFaces.raj, 'raj') const modelState = recognizer.getDescriptorState() expect(modelState).to.be.an('array').lengthOf(2) expect(modelState).to.deep.have.members([ { className: 'sheldon', numFaces: 2 }, { className: 'raj', numFaces: 2 } ]) })
it('should get 0 rooms (take = 0)', async () => { const rooms = await room.get({ expand: ['devices'], take: 0, }); expect(rooms).to.be.instanceOf(Array); expect(rooms).to.have.lengthOf(0); });
describe('#loadEnvs', () => { it('should return an object built from all keys from process.env that start with a given prefix', () => { process.env.DANCE_NOW = 'everybody'; const result = config.loadEnvs('DANCE'); expect(result).to.be.an('object'); expect(result).to.have.key('now'); expect(result.now).to.equal(process.env.DANCE_NOW); }); });
describe('#stripEnvs', () => { it('should return process.env stripped of all keys that start with prefix', () => { process.env.DANCE_NOW = 'everybody'; const result = config.stripEnv('DANCE'); expect(result).to.be.an('object'); expect(result).to.not.have.key('DANCE_NOW'); expect(process.env).to.not.have.key('DANCE_NOW'); }); });
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('gae_flex_postgres_connect', () => { it('should be listening', async () => { const child = childProcess.exec(`node ${appPath}`); const isOpen = await waitPort({port: PORT}); expect(isOpen).to.be.true; process.kill(child.pid, 'SIGTERM'); }); });
describe('#getId', () => { it('should return the correct default options when not specified'); it('#getId should return an object.', () => { const getIdResult = compose.getId( ['string1', 'string2'], 'my_project', myOpts ); expect(getIdResult).to.be.an('object'); }); });
describe('server listening', () => { it('should be listening', async () => { const server = require('../index.js'); const isOpen = await waitPort({port: PORT}); expect(isOpen).to.be.true; server.close(); }); });
describe('#stop', () => { it('should return the correct default options when not specified'); it('#stop should return an object.', () => { const stopResult = compose.stop( ['string1', 'string2'], 'my_project', myOpts ); expect(stopResult).to.be.an('object'); }); });