summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/functions/404.test.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-08-11 19:26:32 -0400
committerGravatar GitHub <noreply@github.com> 2022-08-11 16:26:32 -0700
commitd3d09a2c9f1af4dc467783c8bf4a71800924d129 (patch)
treef35ae1cf79471321bad14e5069b2d9c5dc6aa6df /packages/integrations/netlify/test/functions/404.test.js
parentbe6470688f2cbf71ec210fd9726844fdbd83b1bd (diff)
downloadastro-d3d09a2c9f1af4dc467783c8bf4a71800924d129.tar.gz
astro-d3d09a2c9f1af4dc467783c8bf4a71800924d129.tar.zst
astro-d3d09a2c9f1af4dc467783c8bf4a71800924d129.zip
Add 404 routing logic to Netlify redirects file (#4274)
* Add 404 routing logic to Netlify redirects file * changeset
Diffstat (limited to 'packages/integrations/netlify/test/functions/404.test.js')
-rw-r--r--packages/integrations/netlify/test/functions/404.test.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/integrations/netlify/test/functions/404.test.js b/packages/integrations/netlify/test/functions/404.test.js
new file mode 100644
index 000000000..1bb5d90bd
--- /dev/null
+++ b/packages/integrations/netlify/test/functions/404.test.js
@@ -0,0 +1,27 @@
+import { expect } from 'chai';
+import netlifyAdapter from '../../dist/index.js';
+import { loadFixture, testIntegration } from './test-utils.js';
+
+describe('404 page', () => {
+ /** @type {import('./test-utils').Fixture} */
+ let fixture;
+
+ before(async () => {
+ fixture = await loadFixture({
+ root: new URL('./fixtures/404/', import.meta.url).toString(),
+ output: 'server',
+ adapter: netlifyAdapter({
+ dist: new URL('./fixtures/404/dist/', import.meta.url),
+ }),
+ site: `http://example.com`,
+ integrations: [testIntegration()],
+ });
+ await fixture.build();
+ });
+
+ it('404 route is included in the redirect file', async () => {
+ const redir = await fixture.readFile('/_redirects');
+ const expr = new RegExp("/* /.netlify/functions/entry 404");
+ expect(redir).to.match(expr);
+ });
+});