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!' }) }) })
sandbox.reset();
sandbox.reset() require.cache = {} Shimmer.unwrap(Module, '_load')
sandbox.reset() require.cache = {} Shimmer.unwrap(Module, '_load')
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!' }) }) })
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!' }) }) })