afterEach(() => { sandbox.restore() })
describe('JSTest dependencies', () => { afterEach(() => { sandbox.restore(); }); it('test', () => { const fakeStubs = sourceHelpers.loadSource( helpers.BASE_DIR, 'JSTests/fake_stub.js'); sandbox.stub(sourceHelpers, 'loadResource').callsFake(() => fakeStubs); testLoad('JSTests/load.js', 'JSTests/load_expected.js'); }); });
describe('Controllers: Flags#get', () => { afterEach(() => sandbox.reset()) after(() => sandbox.restore()) it('should return an error message if receives an invalid key', async () => { const req = { params: { key: 'orlando' } } const send = sandbox.stub() res.status.returns({ send }) await flagsController.get(req, res) expect(res.status).to.have.been.calledWith(404) expect(send).to.have.been.calledWith({ error: 'Not found!' }) }) })
describe('Team', () => { afterEach(() => { sandbox.restore(); }); it('#getTeam', async () => { const users = [1, 2]; const findStub = sandbox.stub(User, 'find').resolves(users); const team = await Team.getTeam(); expect(findStub).to.be.calledOnce; expect(team).to.equal(users); }) });
afterEach(() => { delete getAllowanceCommand.erc20TokenService sandbox.restore() })
afterEach(() => { app = rewire('./app'); sandbox.restore(); });
afterEach(() => { sandbox.restore(); users = rewire('./users'); })
afterEach(function () { global.sandbox.restore() })
describe('Controllers: Search#search', () => { afterEach(() => sandbox.reset()) after(() => sandbox.restore()) it('should return an error message if receives an invalid word', async () => { const req = { query: { q: '999' } } const send = sandbox.stub() res.status.returns({ send }) await searchController(req, res) expect(res.status).to.have.been.calledWith(404) expect(send).to.have.been.calledWith({ error: 'Not found!' }) }) })
describe('Controllers: Dialect#find', () => { afterEach(() => sandbox.reset()) after(() => sandbox.restore()) it('should return an error message if receives an invalid region', async () => { const req = { params: { region: 'does-not-exist' } } const send = sandbox.stub() res.status.returns({ send }) await findDialect(req, res) expect(res.status).to.have.been.calledWith(404) expect(send).to.have.been.calledWith({ error: 'Not found!' }) }) })
afterEach(() => sandbox.restore());
afterEach(function () { sandbox.restore() })
afterEach(function() { sandbox.restore(); });
test.afterEach(() => { sandbox.restore(); });
afterEach(function() { sandbox.restore(); });