File size: 882 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import { nextTestSetup } from 'e2e-utils'
describe('app-dir absolute assetPrefix', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('bundles should return 200 on served assetPrefix', async () => {
const $ = await next.render$('/')
let bundles = []
for (const script of $('script').toArray()) {
const { src } = script.attribs
if (
src?.includes(
'https://example.vercel.sh/custom-asset-prefix/_next/static'
)
) {
bundles.push(src)
}
}
expect(bundles.length).toBeGreaterThan(0)
for (const src of bundles) {
// Remove hostname to check if pathname is still used for serving the bundles
const bundlePathWithoutHost = decodeURI(new URL(src).pathname)
const { status } = await next.fetch(bundlePathWithoutHost)
expect(status).toBe(200)
}
})
})
|