Skip to content

Commit c186d01

Browse files
Merge pull request #1080 from OpenSourceFellows/saumil-1077-fix-axios-test
added await to get request
2 parents 8508505 + 8417eef commit c186d01

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

server/__tests__/integration/axios-cache-interceptor.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ describe('test Axios cache invalidation option', () => {
4141
// we set the ttl to 10 seconds
4242
const axios = Axios.create()
4343
const cache_interceptor = setupCache(axios, { ttl: 10000 })
44-
// we make a simple request
45-
cache_interceptor.get('https://github.com/OpenSourceFellows/amplify')
46-
// we wait for 11 seconds and make another call
44+
// make a simple request
45+
await cache_interceptor.get('https://github.com/OpenSourceFellows/amplify')
46+
// wait for 11 seconds and make another call
4747
await new Promise((resolve) => setTimeout(() => resolve(), 11000))
48-
const req3 = cache_interceptor.get('https://github.com/OpenSourceFellows/amplify')
49-
const res3 = await req3
48+
const res3 = await cache_interceptor.get('https://github.com/OpenSourceFellows/amplify')
5049
// assertions: the second request is expected not to be cached, due to the ttl
5150
expect(res3.cached).toBe(false)
5251
}, 70000)

0 commit comments

Comments
 (0)