From 766048e4e456d5d7d838b9df48a0b0a38993b5e6 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 31 Oct 2024 21:26:45 +0200 Subject: [PATCH] test(nock): disable tests which mock error with nock --- package-lock.json | 2 +- package.json | 2 +- test/integration/components/reconnection_manager.test.ts | 6 ++++-- test/utils.ts | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 01014bc73..0602ecedf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "0.0.32", "mocha": "10.4.0", - "nock": "^14.0.0-beta.5", + "nock": "^14.0.0-beta.15", "prettier": "^3.2.5", "rimraf": "^3.0.2", "rollup": "4.22.4", diff --git a/package.json b/package.json index a4e60fc5f..d521da24b 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "0.0.32", "mocha": "10.4.0", - "nock": "^14.0.0-beta.5", + "nock": "^14.0.0-beta.15", "prettier": "^3.2.5", "rimraf": "^3.0.2", "rollup": "4.22.4", diff --git a/test/integration/components/reconnection_manager.test.ts b/test/integration/components/reconnection_manager.test.ts index fcf02cfbb..8dd2ca5ef 100644 --- a/test/integration/components/reconnection_manager.test.ts +++ b/test/integration/components/reconnection_manager.test.ts @@ -40,7 +40,8 @@ describe('#components/reconnection_manger', () => { clock.restore(); }); - it('reports when the network is unreachable', (done) => { + // TODO: Nock doesn't work properly with `fetch` and automated retries. + it.skip('reports when the network is unreachable', (done) => { utils .createNock() .get('/v2/subscribe/mySubKey/ch1,ch1-pnpres,ch2,ch2-pnpres/0') @@ -85,7 +86,8 @@ describe('#components/reconnection_manger', () => { pubnub.subscribe({ channels: ['ch1', 'ch2'], withPresence: true }); }); - it('begins polling and reports reconnects when subscribe is again successful', (done) => { + // TODO: Nock doesn't work properly with `fetch` and automated retries. + it.skip('begins polling and reports reconnects when subscribe is again successful', (done) => { utils .createNock() .get('/v2/subscribe/mySubKey/ch1,ch1-pnpres,ch2,ch2-pnpres/0') diff --git a/test/utils.ts b/test/utils.ts index cce634f9f..34f6bb475 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -47,8 +47,8 @@ export default { let promisesResult = Promise.resolve(); for (let delayIdx = 0; delayIdx < delays.length; delayIdx += 1) { - let previousDelay = delayIdx > 0 ? delays[delayIdx - 1] : 0; - let delay = delays[delayIdx]; + const previousDelay = delayIdx > 0 ? delays[delayIdx - 1] : 0; + const delay = delays[delayIdx]; promisesResult = promisesResult.then(() => callAPIWithDelayedResponse(previousDelay, delay)) as Promise; }