0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00
astro/packages/integrations/vercel/test/server-islands.test.js
Matthew Phillips fe3afebd65
Fix Server Islands in Vercel (#11491)
* Fix Server Islands in Vercel

* Add a changeset

* Get server islands pattern from the segments

* Move getPattern so it can be used at runtime

* Fix build
2024-07-18 16:03:39 +01:00

29 lines
752 B
JavaScript

import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { loadFixture } from './test-utils.js';
describe('Server Islands', () => {
/** @type {import('./test-utils.js').Fixture} */
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/server-islands/',
});
await fixture.build();
});
it('server islands route is in the config', async () => {
const config = JSON.parse(
await fixture.readFile('../.vercel/output/config.json')
);
let found = null;
for(let route of config.routes) {
if(route.src?.includes('_server-islands')) {
found = route;
break;
}
}
assert.notEqual(found, null, 'Default server islands route included');
});
});