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/edge-middleware.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/edge-middleware.test.js')
-rw-r--r-- | packages/integrations/netlify/test/functions/edge-middleware.test.js | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/packages/integrations/netlify/test/functions/edge-middleware.test.js b/packages/integrations/netlify/test/functions/edge-middleware.test.js index a83720a4d..7e51b20da 100644 --- a/packages/integrations/netlify/test/functions/edge-middleware.test.js +++ b/packages/integrations/netlify/test/functions/edge-middleware.test.js @@ -1,44 +1,20 @@ -import netlifyAdapter from '../../dist/index.js'; -import { testIntegration, loadFixture } from './test-utils.js'; +import { fileURLToPath } from 'url'; +import { cli } from './test-utils.js'; +import fs from 'fs/promises'; import { expect } from 'chai'; describe('Middleware', () => { it('with edge handle file, should successfully build the middleware', async () => { - /** @type {import('./test-utils').Fixture} */ - const fixture = await loadFixture({ - root: new URL('./fixtures/middleware-with-handler-file/', import.meta.url).toString(), - output: 'server', - adapter: netlifyAdapter({ - dist: new URL('./fixtures/middleware-with-handler-file/dist/', import.meta.url), - edgeMiddleware: true, - }), - site: `http://example.com`, - integrations: [testIntegration()], - build: { - excludeMiddleware: true, - }, - }); - await fixture.build(); - const contents = await fixture.readFile('../.netlify/edge-functions/edgeMiddleware.js'); + const root = new URL('./fixtures/middleware-with-handler-file/', import.meta.url).toString(); + await cli('build', '--root', fileURLToPath(root)); + const contents = await fs.readFile(new URL('./.netlify/edge-functions/edgeMiddleware.js', root), 'utf-8'); expect(contents.includes('"Hello world"')).to.be.true; }); it('without edge handle file, should successfully build the middleware', async () => { - /** @type {import('./test-utils').Fixture} */ - const fixture = await loadFixture({ - root: new URL('./fixtures/middleware-without-handler-file/', import.meta.url).toString(), - output: 'server', - adapter: netlifyAdapter({ - dist: new URL('./fixtures/middleware-without-handler-file/dist/', import.meta.url), - }), - site: `http://example.com`, - integrations: [testIntegration()], - build: { - excludeMiddleware: true, - }, - }); - await fixture.build(); - const contents = await fixture.readFile('../.netlify/edge-functions/edgeMiddleware.js'); + const root = new URL('./fixtures/middleware-without-handler-file/', import.meta.url).toString(); + await cli('build', '--root', fileURLToPath(root)); + const contents = await fs.readFile(new URL('./.netlify/edge-functions/edgeMiddleware.js', root), 'utf-8'); expect(contents.includes('"Hello world"')).to.be.false; }); }); |