diff options
author | 2022-08-11 19:26:32 -0400 | |
---|---|---|
committer | 2022-08-11 16:26:32 -0700 | |
commit | d3d09a2c9f1af4dc467783c8bf4a71800924d129 (patch) | |
tree | f35ae1cf79471321bad14e5069b2d9c5dc6aa6df /packages/integrations/netlify/test/functions/404.test.js | |
parent | be6470688f2cbf71ec210fd9726844fdbd83b1bd (diff) | |
download | astro-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.js | 27 |
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); + }); +}); |