astro/packages/integrations/netlify/test/dynamic-route.test.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
JavaScript
Raw Normal View History

import { expect } from 'chai';
import { load as cheerioLoad } from 'cheerio';
import { loadFixture } from '../../../astro/test/test-utils.js';
import netlifyAdapter from '../dist/index.js';
import { fileURLToPath } from 'url';
// Asset bundling
describe('Dynamic pages', () => {
/** @type {import('../../../astro/test/test-utils').Fixture} */
let fixture;
before(async () => {
fixture = await loadFixture({
root: new URL('./fixtures/dynamic-route/', import.meta.url).toString(),
experimental: {
ssr: true,
},
adapter: netlifyAdapter({
2022-04-06 20:22:36 +00:00
dist: new URL('./fixtures/dynamic-route/dist/', import.meta.url),
}),
site: `http://example.com`,
vite: {
resolve: {
2022-04-06 20:22:36 +00:00
alias: {
'@astrojs/netlify/netlify-functions.js': fileURLToPath(
new URL('../dist/netlify-functions.js', import.meta.url)
),
},
},
},
});
await fixture.build();
});
it('Dynamic pages are included in the redirects file', async () => {
const redir = await fixture.readFile('/_redirects');
expect(redir).to.match(/\/products\/\*/);
});
});