diff options
author | 2023-09-25 15:52:27 -0400 | |
---|---|---|
committer | 2023-10-15 08:36:37 +0200 | |
commit | 1e0610b088a518ea257287da9d1bc0ccd15cb522 (patch) | |
tree | b970fe5815dea1d5386e645e232a902cd83c022b /packages/integrations/netlify/test/functions/dynamic-route.test.js | |
parent | b750be65ff69c5c219f3f74abbc1e6f8a64e6830 (diff) | |
download | astro-1e0610b088a518ea257287da9d1bc0ccd15cb522.tar.gz astro-1e0610b088a518ea257287da9d1bc0ccd15cb522.tar.zst astro-1e0610b088a518ea257287da9d1bc0ccd15cb522.zip |
chore(netlify): fixes after migration
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Reuben Tier <64310361+TheOtterlord@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/netlify/test/functions/dynamic-route.test.js')
-rw-r--r-- | packages/integrations/netlify/test/functions/dynamic-route.test.js | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/packages/integrations/netlify/test/functions/dynamic-route.test.js b/packages/integrations/netlify/test/functions/dynamic-route.test.js index 6bb68eab8..2e20454e6 100644 --- a/packages/integrations/netlify/test/functions/dynamic-route.test.js +++ b/packages/integrations/netlify/test/functions/dynamic-route.test.js @@ -1,31 +1,22 @@ import { expect } from 'chai'; -import netlifyAdapter from '../../dist/index.js'; -import { loadFixture, testIntegration } from './test-utils.js'; +import { cli } from './test-utils.js'; +import { fileURLToPath } from 'url'; +import fs from 'fs/promises'; -describe('Dynamic pages', () => { - /** @type {import('./test-utils').Fixture} */ - let fixture; +const root = new URL('./fixtures/dynamic-route/', import.meta.url).toString(); +describe('Dynamic pages', () => { 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(); + await cli('build', '--root', fileURLToPath(root)); }); it('Dynamic pages are included in the redirects file', async () => { - const redir = await fixture.readFile('/_redirects'); + const redir = await fs.readFile(new URL('./dist/_redirects', root), 'utf-8'); expect(redir).to.match(/\/products\/:id/); }); it('Prerendered routes are also included using placeholder syntax', async () => { - const redir = await fixture.readFile('/_redirects'); + const redir = await fs.readFile(new URL('./dist/_redirects', root), 'utf-8'); 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'); |