Commit 9c06ba9b authored by Robert Knight's avatar Robert Knight

Fix a test that did not execute intended code path

The customized result for the first stub call was not used because a
more specific response was defined earlier using `withArgs`.
parent ffa9de55
......@@ -83,11 +83,16 @@ describe('APIRoutesService', () => {
);
});
it('retries the route fetch until it succeeds', () => {
window.fetch.onFirstCall().returns(httpResponse(500, null));
return apiRoutes.routes().then(routes => {
assert.deepEqual(routes, apiIndexResponse.links);
});
it('retries the route fetch until it succeeds', async () => {
window.fetch
.withArgs('https://annotation.service/api/')
.onFirstCall()
.returns(httpResponse(500, null));
const routes = await apiRoutes.routes();
assert.calledTwice(window.fetch);
assert.deepEqual(routes, apiIndexResponse.links);
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment