aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/static/redirects.test.js
blob: cab95483143d00d9eb08ee8768ad089e570f3dd4 (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
34
import * as assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { loadFixture } from '../../../../astro/test/test-utils.js';

describe('SSG - Redirects', () => {
	let fixture;

	before(async () => {
		fixture = await loadFixture({ root: new URL('./fixtures/redirects/', import.meta.url) });
		await fixture.build();
	});

	it('Creates a redirects file', async () => {
		const redirects = await fixture.readFile('./_redirects');
		const parts = redirects.split(/\s+/);
		assert.deepEqual(parts, [
			'',

			'/two',
			'/',
			'302',

			'/other',
			'/',
			'301',

			'/blog/*',
			'/team/articles/*/index.html',
			'301',

			'',
		]);
	});
});