2020-01-05 11:55:59 +00:00
|
|
|
import * as checksums from '../src/checksums'
|
2021-05-14 08:35:46 +00:00
|
|
|
import nock from 'nock'
|
2022-10-24 16:16:09 +00:00
|
|
|
import {afterEach, describe, expect, test, jest} from '@jest/globals'
|
|
|
|
|
|
|
|
jest.setTimeout(30000)
|
2020-01-05 11:55:59 +00:00
|
|
|
|
|
|
|
test('fetches wrapper jars checksums', async () => {
|
2020-01-06 10:56:42 +00:00
|
|
|
const validChecksums = await checksums.fetchValidChecksums(false)
|
2024-01-31 17:45:32 +00:00
|
|
|
expect(validChecksums.size).toBeGreaterThan(10)
|
2020-01-05 11:55:59 +00:00
|
|
|
})
|
2021-05-14 08:35:46 +00:00
|
|
|
|
|
|
|
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)
|
2024-01-31 17:45:32 +00:00
|
|
|
expect(validChecksums.size).toBeGreaterThan(10)
|
2021-05-14 08:35:46 +00:00
|
|
|
nock.isDone()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|