Skip to content

Commit

Permalink
Merge pull request #39 from KengoTODA/retry
Browse files Browse the repository at this point in the history
  • Loading branch information
JLLeitschuh authored May 18, 2021
2 parents 12b3fff + aeee4bd commit d01b023
Show file tree
Hide file tree
Showing 5 changed files with 1,515 additions and 114 deletions.
23 changes: 23 additions & 0 deletions __tests__/checksums.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
import * as checksums from '../src/checksums'
import nock from 'nock'

test('fetches wrapper jars checksums', async () => {
const validChecksums = await checksums.fetchValidChecksums(false)
expect(validChecksums.length).toBeGreaterThan(10)
})

describe('retry', () => {
afterEach(() => {
nock.cleanAll()
})

describe('for /versions/all API', () => {
test('retry three times', async () => {
nock('https://services.gradle.org', {allowUnmocked: true})
.get('/versions/all')
.times(3)
.replyWithError({
message: 'connect ECONNREFUSED 104.18.191.9:443',
code: 'ECONNREFUSED'
})

const validChecksums = await checksums.fetchValidChecksums(false)
expect(validChecksums.length).toBeGreaterThan(10)
nock.isDone()
})
})
})
Loading

0 comments on commit d01b023

Please sign in to comment.