summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/functions/dynamic-route.test.js
blob: 6bb68eab88ad68f47318f38248f296aee58bbcb4 (plain) (blame)
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
import { expect } from 'chai';
import netlifyAdapter from '../../dist/index.js';
import { loadFixture, testIntegration } from './test-utils.js';

describe('Dynamic pages', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: new URL('./fixtures/dynamic-route/', import.meta.url).toString(),
			output: 'server',
			adapter: netlifyAdapter({
				dist: new URL('./fixtures/dynamic-route/dist/', import.meta.url),
			}),
			site: `http://example.com`,
			integrations: [testIntegration()],
		});
		await fixture.build();
	});

	it('Dynamic pages are included in the redirects file', async () => {
		const redir = await fixture.readFile('/_redirects');
		expect(redir).to.match(/\/products\/:id/);
	});

	it('Prerendered routes are also included using placeholder syntax', async () => {
		const redir = await fixture.readFile('/_redirects');
		expect(redir).to.include('/pets/:cat       /pets/:cat/index.html        200');
		expect(redir).to.include('/pets/:dog       /pets/:dog/index.html        200');
		expect(redir).to.include('/pets            /.netlify/functions/entry    200');
	});
});
/a>Gravatar André Alves 4-2/+54 2023-06-01Fix duplicate `semver minor` blocks (#7269)Gravatar Nate Moore 1-12/+11 2023-06-01fix: build fail upon have 'process.env' in *.md file. (#7257)Gravatar Thiti Yamsung 2-1/+8 2023-05-31[ci] formatGravatar bholmesdev 4-6/+5 2023-05-31Markdoc asset bleed, second try (#7185)Gravatar Ben Holmes 28-131/+653 2023-05-31Fix `semver minor` action (#7261)Gravatar Nate Moore 1-38/+36 2023-05-31Revert "feat(hybrid): unflag hybrid output (#7255)" (#7259)Gravatar Nate Moore 29-65/+139 2023-05-31[ci] formatGravatar natemoo-re 3-13/+8 2023-05-31feat(hybrid): unflag hybrid output (#7255)Gravatar Nate Moore 29-130/+61 2023-05-31Markdoc: strip HTML comments from output (#7224)Gravatar Ben Holmes 2-1/+13 2023-05-30Fix out-of-date example dependencies (#7248)Gravatar Ben Holmes 33-198/+211 2023-05-30[ci] release (#7190)astro@2.5.6@astrojs/webapi@2.2.0@astrojs/vue@2.2.1@astrojs/vercel@3.4.1@astrojs/sitemap@1.3.2@astrojs/react@2.2.1@astrojs/preact@2.2.1@astrojs/partytown@1.2.3@astrojs/mdx@0.19.5@astrojs/markdoc@0.3.0Gravatar Houston (Bot) 48-171/+216 2023-05-30Content collections - fix `.json` collection errors (#7246)Gravatar Ben Holmes 4-7/+52 2023-05-30[ci] formatGravatar bholmesdev 4-5/+5 2023-05-30Markdoc - remove `$entry` variable (#7244)Gravatar Ben Holmes 16-257/+217 2023-05-30Markdoc: new README for Markdoc nodes (#7225)Gravatar Ben Holmes 1-46/+85 2023-05-30[ci] formatGravatar MoustaphaDev 1-1/+1 2023-05-30fix: prioritize dynamic prerendered routes over dynamic server routes (#7235)Gravatar Happydev 6-19/+361 2023-05-30[ci] formatGravatar matthewp 1-5/+8 2023-05-30Bug 6672 (#7062)Gravatar wulinsheng123 10-0/+138