From e75f4f6d91e3dd85e3013f942cdd92d8376b261b Mon Sep 17 00:00:00 2001 From: lilnasy <69170106+lilnasy@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:12:21 +0000 Subject: [PATCH] add test --- .../fixtures/max-duration/astro.config.mjs | 9 +++++++++ .../test/fixtures/max-duration/package.json | 10 ++++++++++ .../fixtures/max-duration/src/pages/one.astro | 8 ++++++++ .../fixtures/max-duration/src/pages/two.astro | 8 ++++++++ .../vercel/test/max-duration.test.js | 19 +++++++++++++++++++ pnpm-lock.yaml | 9 +++++++++ 6 files changed, 63 insertions(+) create mode 100644 packages/integrations/vercel/test/fixtures/max-duration/astro.config.mjs create mode 100644 packages/integrations/vercel/test/fixtures/max-duration/package.json create mode 100644 packages/integrations/vercel/test/fixtures/max-duration/src/pages/one.astro create mode 100644 packages/integrations/vercel/test/fixtures/max-duration/src/pages/two.astro create mode 100644 packages/integrations/vercel/test/max-duration.test.js diff --git a/packages/integrations/vercel/test/fixtures/max-duration/astro.config.mjs b/packages/integrations/vercel/test/fixtures/max-duration/astro.config.mjs new file mode 100644 index 000000000000..a02d60c14a56 --- /dev/null +++ b/packages/integrations/vercel/test/fixtures/max-duration/astro.config.mjs @@ -0,0 +1,9 @@ +import { defineConfig } from 'astro/config'; +import vercel from '@astrojs/vercel/serverless'; + +export default defineConfig({ + output: "server", + adapter: vercel({ + maxDuration: 60 + }) +}); diff --git a/packages/integrations/vercel/test/fixtures/max-duration/package.json b/packages/integrations/vercel/test/fixtures/max-duration/package.json new file mode 100644 index 000000000000..9a45d782edd9 --- /dev/null +++ b/packages/integrations/vercel/test/fixtures/max-duration/package.json @@ -0,0 +1,10 @@ +{ + "name": "@test/vercel-max-duration", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/vercel": "workspace:*", + "astro": "workspace:*" + } +} + \ No newline at end of file diff --git a/packages/integrations/vercel/test/fixtures/max-duration/src/pages/one.astro b/packages/integrations/vercel/test/fixtures/max-duration/src/pages/one.astro new file mode 100644 index 000000000000..0c7fb90a735e --- /dev/null +++ b/packages/integrations/vercel/test/fixtures/max-duration/src/pages/one.astro @@ -0,0 +1,8 @@ + + + One + + +

One

+ + diff --git a/packages/integrations/vercel/test/fixtures/max-duration/src/pages/two.astro b/packages/integrations/vercel/test/fixtures/max-duration/src/pages/two.astro new file mode 100644 index 000000000000..e7ba9910e2a6 --- /dev/null +++ b/packages/integrations/vercel/test/fixtures/max-duration/src/pages/two.astro @@ -0,0 +1,8 @@ + + + Two + + +

Two

+ + diff --git a/packages/integrations/vercel/test/max-duration.test.js b/packages/integrations/vercel/test/max-duration.test.js new file mode 100644 index 000000000000..9826dcdfbb58 --- /dev/null +++ b/packages/integrations/vercel/test/max-duration.test.js @@ -0,0 +1,19 @@ +import { loadFixture } from './test-utils.js'; +import { expect } from 'chai'; + +describe('maxDuration', () => { + /** @type {import('./test-utils.js').Fixture} */ + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: './fixtures/max-duration/', + }); + await fixture.build(); + }); + + it('makes it to vercel function configuration', async () => { + const vcConfig = JSON.parse(await fixture.readFile('../.vercel/output/functions/render.func/.vc-config.json')); + expect(vcConfig).to.deep.include({ maxDuration: 60 }); + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a19fcf7c8bc3..cfaf9df8d1ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4605,6 +4605,15 @@ importers: specifier: workspace:* version: link:../../../../../astro + packages/integrations/vercel/test/fixtures/max-duration: + dependencies: + '@astrojs/vercel': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + packages/integrations/vercel/test/fixtures/middleware-with-edge-file: dependencies: '@astrojs/vercel':