mirror of
https://github.com/gradle/wrapper-validation-action
synced 2024-11-23 17:22:01 +00:00
32 lines
903 B
TypeScript
32 lines
903 B
TypeScript
import * as checksums from '../src/checksums'
|
|
import nock from 'nock'
|
|
import {afterEach, describe, expect, test, jest} from '@jest/globals'
|
|
|
|
jest.setTimeout(30000)
|
|
|
|
test('fetches wrapper jars checksums', async () => {
|
|
const validChecksums = await checksums.fetchValidChecksums(false)
|
|
expect(validChecksums.size).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.size).toBeGreaterThan(10)
|
|
nock.isDone()
|
|
})
|
|
})
|
|
})
|