summaryrefslogtreecommitdiff
path: root/packages/integrations/vercel/test/split.test.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2023-06-29 16:18:28 -0400
committerGravatar GitHub <noreply@github.com> 2023-06-29 16:18:28 -0400
commit154af8f5ead25b3cf100cfd445329bd1d3fe876a (patch)
tree60986c01518f561e3b3f34f37305f7428abdbe04 /packages/integrations/vercel/test/split.test.js
parent5df4853bd19cab85cd33cc006662669db815e7f8 (diff)
downloadastro-154af8f5ead25b3cf100cfd445329bd1d3fe876a.tar.gz
astro-154af8f5ead25b3cf100cfd445329bd1d3fe876a.tar.zst
astro-154af8f5ead25b3cf100cfd445329bd1d3fe876a.zip
Split support in the Vercel Serverless adapter (#7514)
* start of vercel split support * Split Mode with the Vercel Adapter * Write routes into the config.json * Add a changeset * Add docs * Better changeset
Diffstat (limited to '')
-rw-r--r--packages/integrations/vercel/test/split.test.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/integrations/vercel/test/split.test.js b/packages/integrations/vercel/test/split.test.js
new file mode 100644
index 000000000..b89a428be
--- /dev/null
+++ b/packages/integrations/vercel/test/split.test.js
@@ -0,0 +1,29 @@
+import { loadFixture } from './test-utils.js';
+import { expect } from 'chai';
+
+describe('build: split', () => {
+ /** @type {import('./test-utils').Fixture} */
+ let fixture;
+
+ before(async () => {
+ fixture = await loadFixture({
+ root: './fixtures/basic/',
+ output: 'server',
+ build: {
+ split: true,
+ }
+ });
+ await fixture.build();
+ });
+
+ it('creates separate functions for each page', async () => {
+ const files = await fixture.readdir('../.vercel/output/functions/')
+ expect(files.length).to.equal(2);
+ });
+
+ it('creates the route definitions in the config.json', async () => {
+ const json = await fixture.readFile('../.vercel/output/config.json');
+ const config = JSON.parse(json);
+ expect(config.routes).to.have.a.lengthOf(3);
+ })
+});