Skip to content

Commit

Permalink
test: Almost complete coverage (#239)
Browse files Browse the repository at this point in the history
The only uncovered branch is:
(axiosError as any).config = axiosError.config || {}; // Allow for wider range of errors

which I have no idea how to reach.
  • Loading branch information
orgads authored Nov 16, 2023
1 parent 5d1451c commit 731edbf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,17 @@ describe('retry-axios', () => {
assert.strictEqual(scopes[1].isDone(), false);
});

it('should not retry if Retry-After is invalid', async () => {
const scopes = [
nock(url).get('/').reply(429, undefined, {'Retry-After': 'foo'}),
nock(url).get('/').reply(200, 'toast'),
];
interceptorId = rax.attach();
const cfg: rax.RaxConfig = {url, raxConfig: {maxRetryAfter: 1000}};
await assert.rejects(axios(cfg));
assert.strictEqual(scopes[1].isDone(), false);
});

it('should use maxRetryDelay', async function () {
this.timeout(1000); // Short timeout to trip test if delay longer than expected
const scopes = [
Expand Down

0 comments on commit 731edbf

Please sign in to comment.