Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 65b33e4

Browse files
committedOct 19, 2020
Added additonal unit test to prevent infinite axios retry from coming recurring
1 parent 35d16dc commit 65b33e4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"circle-lint": ".buildscript/circle.sh",
2323
"dependencies": "yarn",
2424
"size": "size-limit",
25-
"test": "standard && nyc ava && .buildscript/e2e.sh",
25+
"test": "standard && nyc ava --timeout=20s&& .buildscript/e2e.sh",
2626
"report-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
2727
"np": "np --no-publish",
2828
"release": "yarn run np"

‎test.js

+20
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ test.before.cb(t => {
7272
})
7373
}
7474

75+
if (batch[0] === 'axios-retry-forever') {
76+
return res.status(503).json({
77+
error: { message: 'Service Unavailable' }
78+
})
79+
}
80+
7581
res.json({})
7682
})
7783
.listen(port, t.end)
@@ -586,6 +592,20 @@ test('ensure that failed requests are retried', async t => {
586592
await t.notThrows(client.flush())
587593
})
588594

595+
test('ensure that failed requests are not retried forever', async t => {
596+
const client = createClient()
597+
const callback = spy()
598+
599+
client.queue = [
600+
{
601+
message: 'axios-retry-forever',
602+
callback
603+
}
604+
]
605+
606+
await t.throws(client.flush())
607+
})
608+
589609
test('ensure other axios clients are not impacted by axios-retry', async t => {
590610
let client = createClient() // eslint-disable-line
591611
const axios = require('axios')

0 commit comments

Comments
 (0)
This repository has been archived.