Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Nov 2, 2019
1 parent db5a6c8 commit db595de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/lib/compile-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const delayResponse = route => {
const { delay } = route;
if (delay) {
const response = route.response;
route.response = () => new Promise(res => setTimeout(() => res(response), delay));
route.response = () =>
new Promise(res => setTimeout(() => res(response), delay));
}
};

Expand Down
9 changes: 2 additions & 7 deletions test/specs/responses.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,12 @@ module.exports = fetchMock => {
});

it('pass values to delayed function', async () => {
const startTimestamp = new Date().getTime();
fm.mock(
'http://it.at.there/',
(url) => `delayed: ${url}`,
{ delay: 10 }
);
fm.mock('http://it.at.there/', url => `delayed: ${url}`, { delay: 10 });
const req = fm.fetchHandler('http://it.at.there/');
await new Promise(res => setTimeout(res, 11));
const res = await req;
expect(res.status).to.equal(200);
expect(await res.text()).to.equal('delayed: http://it.at.there/')
expect(await res.text()).to.equal('delayed: http://it.at.there/');
});

it('call delayed response multiple times, each with the same delay', async () => {
Expand Down

0 comments on commit db595de

Please sign in to comment.