diff --git a/packages/netlify/src/ssr-function.ts b/packages/netlify/src/ssr-function.ts index 33aea271..57d945a3 100644 --- a/packages/netlify/src/ssr-function.ts +++ b/packages/netlify/src/ssr-function.ts @@ -13,7 +13,10 @@ const clientAddressSymbol = Symbol.for('astro.clientAddress'); export const createExports = (manifest: SSRManifest, _args: Args) => { const app = new App(manifest); - function createHandler(integrationConfig: { cacheOnDemandPages: boolean, notFoundContent?: string }) { + function createHandler(integrationConfig: { + cacheOnDemandPages: boolean; + notFoundContent?: string; + }) { return async function handler(request: Request, context: Context) { const routeData = app.match(request); if (!routeData && typeof integrationConfig.notFoundContent !== 'undefined') { diff --git a/packages/netlify/test/functions/cookies.test.js b/packages/netlify/test/functions/cookies.test.js index 56a414d1..cb81d097 100644 --- a/packages/netlify/test/functions/cookies.test.js +++ b/packages/netlify/test/functions/cookies.test.js @@ -24,7 +24,7 @@ describe('Cookies', () => { expect(resp.headers.getSetCookie()).to.eql(['foo=foo; HttpOnly', 'bar=bar; HttpOnly']); }); - it("renders dynamic 404 page", async () => { + it('renders dynamic 404 page', async () => { const entryURL = new URL( './fixtures/cookies/.netlify/functions-internal/ssr/ssr.mjs', import.meta.url @@ -33,14 +33,14 @@ describe('Cookies', () => { const resp = await handler( new Request('http://example.com/nonexistant-page', { headers: { - "x-test": "bar" - } + 'x-test': 'bar', + }, }), {} ); expect(resp.status).to.equal(404); - const text = await resp.text() - expect(text).to.contain("This is my custom 404 page"); - expect(text).to.contain("x-test: bar"); - }) + const text = await resp.text(); + expect(text).to.contain('This is my custom 404 page'); + expect(text).to.contain('x-test: bar'); + }); }); diff --git a/packages/netlify/test/functions/redirects.test.js b/packages/netlify/test/functions/redirects.test.js index 8c1b1fa2..e0819e08 100644 --- a/packages/netlify/test/functions/redirects.test.js +++ b/packages/netlify/test/functions/redirects.test.js @@ -1,6 +1,6 @@ +import { createServer } from 'http'; import { loadFixture } from '@astrojs/test-utils'; import { expect } from 'chai'; -import { createServer } from 'http'; describe('SSR - Redirects', () => { let fixture; @@ -27,40 +27,34 @@ describe('SSR - Redirects', () => { expect(hasErrored).to.equal(true, 'this file should not exist'); }); - it("renders static 404 page", async () => { + it('renders static 404 page', async () => { const entryURL = new URL( './fixtures/redirects/.netlify/functions-internal/ssr/ssr.mjs', import.meta.url ); const { default: handler } = await import(entryURL); - const resp = await handler( - new Request('http://example.com/nonexistant-page', ), - {} - ); + const resp = await handler(new Request('http://example.com/nonexistant-page'), {}); expect(resp.status).to.equal(404); - const text = await resp.text() - expect(text).to.contain("This is my static 404 page"); - }) + const text = await resp.text(); + expect(text).to.contain('This is my static 404 page'); + }); it('does not pass through 404 request', async () => { - let testServerCalls = 0 + let testServerCalls = 0; const testServer = createServer((req, res) => { - testServerCalls++ - res.writeHead(200) - res.end() - }) - testServer.listen(5678) + testServerCalls++; + res.writeHead(200); + res.end(); + }); + testServer.listen(5678); const entryURL = new URL( './fixtures/redirects/.netlify/functions-internal/ssr/ssr.mjs', import.meta.url ); const { default: handler } = await import(entryURL); - const resp = await handler( - new Request('http://localhost:5678/nonexistant-page'), - {} - ); + const resp = await handler(new Request('http://localhost:5678/nonexistant-page'), {}); expect(resp.status).to.equal(404); - expect(testServerCalls).to.equal(0) - testServer.close() + expect(testServerCalls).to.equal(0); + testServer.close(); }); });