diff --git a/sources/test/jest/short-lived-token.test.ts b/sources/test/jest/short-lived-token.test.ts index 0bc83c83..db9867a8 100644 --- a/sources/test/jest/short-lived-token.test.ts +++ b/sources/test/jest/short-lived-token.test.ts @@ -31,30 +31,6 @@ describe('short lived tokens', () => { expect(develocityAccessCredentials?.raw()).toBe('host1=key1;host2=key2') }) - it('get short lived token fails when cannot connect', async () => { - nock('http://localhost:3333') - .post('/api/auth/token') - .times(3) - .replyWithError({ - message: 'connect ECONNREFUSED 127.0.0.1:3333', - code: 'ECONNREFUSED' - }) - await expect(getToken('localhost=key0', false, '')) - .resolves - .toBeNull() - }) - - it('get short lived token is null when request fails', async () => { - nock('http://dev:3333') - .post('/api/auth/token') - .times(3) - .reply(500, 'Internal error') - expect.assertions(1) - await expect(getToken('dev=xyz', false, '')) - .resolves - .toBeNull() - }) - it('get short lived token returns null when access key is empty', async () => { expect.assertions(1) await expect(getToken('', false, '')) @@ -127,3 +103,34 @@ describe('short lived tokens', () => { .toEqual({"keys": [{"hostname": "dev", "key": "token"}]}) }) }) + +describe('short lived tokens with retry', () => { + afterEach(() => { + nock.cleanAll() + nock.restore() + }) + + it('get short lived token fails when cannot connect', async () => { + nock('http://localhost:3333') + .post('/api/auth/token') + .times(3) + .replyWithError({ + message: 'connect ECONNREFUSED 127.0.0.1:3333', + code: 'ECONNREFUSED' + }) + await expect(getToken('localhost=key0', false, '')) + .resolves + .toBeNull() + }) + + it('get short lived token is null when request fails', async () => { + nock('http://dev:3333') + .post('/api/auth/token') + .times(3) + .reply(500, 'Internal error') + expect.assertions(1) + await expect(getToken('dev=xyz', false, '')) + .resolves + .toBeNull() + }) +}) diff --git a/sources/test/jest/wrapper-validation/checksums.test.ts b/sources/test/jest/wrapper-validation/checksums.test.ts index 38fb9ade..ff2edfaa 100644 --- a/sources/test/jest/wrapper-validation/checksums.test.ts +++ b/sources/test/jest/wrapper-validation/checksums.test.ts @@ -58,6 +58,7 @@ test('fetches wrapper jar checksums for snapshots', async () => { describe('retry', () => { afterEach(() => { nock.cleanAll() + nock.restore() }) describe('for /versions/all API', () => {