From b382f7e19cb402498935828d125bf52f64e2caed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 9 Oct 2024 21:56:34 +0900 Subject: [PATCH] test(css): make "duplicate CSS" test to focus on what it's testing (#18308) --- .../__tests__/css-dynamic-import.spec.ts | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/playground/css-dynamic-import/__tests__/css-dynamic-import.spec.ts b/playground/css-dynamic-import/__tests__/css-dynamic-import.spec.ts index fee306501..4b473d985 100644 --- a/playground/css-dynamic-import/__tests__/css-dynamic-import.spec.ts +++ b/playground/css-dynamic-import/__tests__/css-dynamic-import.spec.ts @@ -65,38 +65,9 @@ baseOptions.forEach(({ base, label }) => { await page.waitForSelector('.loaded', { state: 'attached' }) expect(await getColor('.css-dynamic-import')).toBe('green') - expect(await getLinks()).toEqual([ - { - pathname: expect.stringMatching(/^\/assets\/index-.+\.css$/), - rel: 'stylesheet', - as: '', - }, - { - pathname: expect.stringMatching(/^\/assets\/dynamic-.+\.css$/), - rel: 'preload', - as: 'style', - }, - { - pathname: expect.stringMatching(/^\/assets\/dynamic-.+\.js$/), - rel: 'modulepreload', - as: 'script', - }, - { - pathname: expect.stringMatching(/^\/assets\/dynamic-.+\.css$/), - rel: 'stylesheet', - as: '', - }, - { - pathname: expect.stringMatching(/^\/assets\/static-.+\.js$/), - rel: 'modulepreload', - as: 'script', - }, - { - pathname: expect.stringMatching(/^\/assets\/index-.+\.js$/), - rel: 'modulepreload', - as: 'script', - }, - ]) + const linkUrls = (await getLinks()).map((link) => link.pathname) + const uniqueLinkUrls = [...new Set(linkUrls)] + expect(linkUrls).toStrictEqual(uniqueLinkUrls) }) }, )