From 532619a8c2b48dd9d9c7c6cc0dfd2d9821cccdc7 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Fri, 22 Aug 2025 17:45:39 +0800 Subject: [PATCH] fix(tests): update expected values and increase timeout for Puppeteer tests - Adjusted expected values in error handling tests to reflect updated application behavior. - Increased timeout for Puppeteer tests from 20 seconds to 45 seconds to accommodate longer loading times. --- lib/errors/index.test.ts | 12 +++++++----- lib/utils/puppeteer-utils.test.ts | 6 +++--- lib/utils/puppeteer.test.ts | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/errors/index.test.ts b/lib/errors/index.test.ts index 8bd71e9e5..511f45f65 100644 --- a/lib/errors/index.test.ts +++ b/lib/errors/index.test.ts @@ -75,19 +75,21 @@ describe('route throws an error', () => { const value = $(item).find('.debug-value').html()?.trim(); switch (key) { case 'Request Amount:': - expect(value).toBe('11'); + expect(value).toBe('12'); break; case 'Hot Routes:': - expect(value).toBe('8 /test/:id/:params?
'); + expect(value).toBe('9 /test/:id/:params?
'); break; case 'Hot Paths:': - expect(value).toBe('2 /test/error
2 /test/slow
2 /test/slow4
1 /test/httperror
1 /test/config-not-found-error
1 /test/invalid-parameter-error
1 /thisDoesNotExist
1 /
'); + expect(value).toBe( + '2 /test/error
2 /test/slow
2 /test/slow4
1 /test/httperror
1 /test/config-not-found-error
1 /test/invalid-parameter-error
1 /test/captcha-error
1 /thisDoesNotExist
1 /
' + ); break; case 'Hot Error Routes:': - expect(value).toBe('5 /test/:id/:params?
'); + expect(value).toBe('6 /test/:id/:params?
'); break; case 'Hot Error Paths:': - expect(value).toBe('2 /test/error
1 /test/httperror
1 /test/slow4
1 /test/config-not-found-error
1 /test/invalid-parameter-error
1 /thisDoesNotExist
'); + expect(value).toBe('2 /test/error
1 /test/httperror
1 /test/slow4
1 /test/config-not-found-error
1 /test/invalid-parameter-error
1 /test/captcha-error
1 /thisDoesNotExist
'); break; default: } diff --git a/lib/utils/puppeteer-utils.test.ts b/lib/utils/puppeteer-utils.test.ts index 4e4b7066a..dd2176159 100644 --- a/lib/utils/puppeteer-utils.test.ts +++ b/lib/utils/puppeteer-utils.test.ts @@ -74,7 +74,7 @@ describe('puppeteer-utils', () => { waitUntil: 'domcontentloaded', }); expect((await getCookies(page, 'httpbingo.org')).split('; ').sort()).toEqual(['foo=bar', 'baz=qux'].sort()); - }, 20000); + }, 45000); it('setCookies httpbingo', async () => { browser = await puppeteer(); @@ -86,7 +86,7 @@ describe('puppeteer-utils', () => { }); const data = await page.evaluate(() => JSON.parse(document.body.textContent || '')); expect(data).toEqual(Object.fromEntries(cookieArrayExampleCom.map(({ name, value }) => [name, value]))); - }, 20000); + }, 45000); it('setCookies & getCookies example.org', async () => { browser = await puppeteer(); @@ -97,5 +97,5 @@ describe('puppeteer-utils', () => { waitUntil: 'domcontentloaded', }); expect((await getCookies(page, 'example.org')).split('; ').sort()).toEqual(cookieStrAll.split('; ').sort()); - }, 20000); + }, 45000); }); diff --git a/lib/utils/puppeteer.test.ts b/lib/utils/puppeteer.test.ts index f9ef4de22..79383ffa0 100644 --- a/lib/utils/puppeteer.test.ts +++ b/lib/utils/puppeteer.test.ts @@ -55,7 +55,7 @@ describe('puppeteer', () => { // these are something we really care about expect(webDriverTest).toBe('missing (passed)'); expect(chromeTest).toBe('present (passed)'); - }, 20000); + }, 45000); // } it('puppeteer accept http proxy uri w/ auth', async () => {