describe('fahrenheitToCelsius', () => { it('should convert fahrenheit to celsius', () => { const celsius = fahrenheitToCelsius(68); expect(celsius).to.equal(20); }); });
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('user.getUserCount', () => { const session = new Session('secret'); const state = new StateManager(); const user = new User(session, state); it('should return number of users', async () => { state.setState('user', 'tony', {}); const numberOfUser = user.getUserCount(); expect(numberOfUser).to.equal(1); }); });
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); }); });
it('should mirror process.env', () => { const env = config.defaults().env; expect(hasher(env)).to.equal(hasher(process.env)); process.env.NEW = 'things'; expect(hasher(env)).to.equal(hasher(process.env)); delete process.env.NEW; expect(hasher(env)).to.equal(hasher(process.env)); env.NEW2 = 'morethings'; expect(hasher(env)).to.equal(hasher(process.env)); delete env.NEW2; expect(hasher(env)).to.equal(hasher(process.env)); });
describe('API /', () => { it('it should return Welcome message', (done) => { chai.request(app) .get('/') .end((err, res) => { res.should.have.status(200); res.should.to.be.html; res.text.should.be.equal("Hello Docker World\n"); done(); }); }); });
it("Should have been imported properly", function(){ var index = new FlexSearch("match"); index.import(data); expect(index.length).to.equal(3); expect(index.search("foo")).to.have.lengthOf(2); expect(index.search("bar")).to.have.lengthOf(2); expect(index.search("foobar")).to.have.lengthOf(1); expect(index.search("foobar")[0]).to.equal(2); });
describe("Remove (Sync)", function(){ it("Should have been removed from the index", function(){ flexsearch_sync.remove(0); flexsearch_sync.remove(2); flexsearch_sync.remove(1); expect(flexsearch_sync.length).to.equal(0); expect(flexsearch_sync.search("foo")).to.have.lengthOf(0); expect(flexsearch_sync.search("bar")).to.have.lengthOf(0); expect(flexsearch_sync.search("foobar")).to.have.lengthOf(0); }); });
describe("isVisible", () => { it("returns the visibility of the popup", () => { const gotoTimeView = new GotoTimeView(options); gotoTimeView.toggle(); expect(gotoTimeView.node.toggle).to.have.been.calledOnce; expect(gotoTimeView.isVisible()).to.equal(false); }); });
describe('celsiusToFahrenheit', () => { it('should convert celsius to fahrenheit', () => { const fahrenheit = celsiusToFahrenheit(20); expect(fahrenheit).to.equal(68); }); });