test(css): make "duplicate CSS" test to focus on what it's testing (#18308)

This commit is contained in:
翠 / green 2024-10-09 21:56:34 +09:00 committed by GitHub
parent cd368f9fed
commit b382f7e19c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,38 +65,9 @@ baseOptions.forEach(({ base, label }) => {
await page.waitForSelector('.loaded', { state: 'attached' }) await page.waitForSelector('.loaded', { state: 'attached' })
expect(await getColor('.css-dynamic-import')).toBe('green') expect(await getColor('.css-dynamic-import')).toBe('green')
expect(await getLinks()).toEqual([ const linkUrls = (await getLinks()).map((link) => link.pathname)
{ const uniqueLinkUrls = [...new Set(linkUrls)]
pathname: expect.stringMatching(/^\/assets\/index-.+\.css$/), expect(linkUrls).toStrictEqual(uniqueLinkUrls)
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',
},
])
}) })
}, },
) )