diff options
author | 2023-06-30 11:09:21 +0200 | |
---|---|---|
committer | 2023-06-30 10:09:21 +0100 | |
commit | 1a59185ddd393bf8894ec0c981b26d6fecdb3c67 (patch) | |
tree | 388bbb6d419f40c5527bd7469937a735a1f5296e /packages/integrations/cloudflare/test/directory-split.test.js | |
parent | 7ae6e892921fd47c630b289a28d8100414f861e2 (diff) | |
download | astro-1a59185ddd393bf8894ec0c981b26d6fecdb3c67.tar.gz astro-1a59185ddd393bf8894ec0c981b26d6fecdb3c67.tar.zst astro-1a59185ddd393bf8894ec0c981b26d6fecdb3c67.zip |
feature(astrojs/cloudflare): add support for `splitted` SSR bundles (#7464)
* initial commit
* try to fix windows
* output files directly into the correct folder
* allow for rest parameters
* use fixed hook
* improve tests
* apply doc's team suggestions for README
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* try to fix prerendering
* apply doc's team suggestion for changeset
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* bump to minor
* readme update
* resolve review comments
* optimize memory allocation
* resolve review comments
* add removed link, to make sure old docs keep same
* resolve comment
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
---------
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Diffstat (limited to 'packages/integrations/cloudflare/test/directory-split.test.js')
-rw-r--r-- | packages/integrations/cloudflare/test/directory-split.test.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/integrations/cloudflare/test/directory-split.test.js b/packages/integrations/cloudflare/test/directory-split.test.js new file mode 100644 index 000000000..8bb6cd872 --- /dev/null +++ b/packages/integrations/cloudflare/test/directory-split.test.js @@ -0,0 +1,44 @@ +import { loadFixture } from './test-utils.js'; +import { expect } from 'chai'; +import cloudflare from '../dist/index.js'; + +/** @type {import('./test-utils').Fixture} */ +describe('Cloudflare SSR split', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: './fixtures/split/', + adapter: cloudflare({ mode: 'directory' }), + output: "server", + build: { + split: true, + excludeMiddleware: false + }, + vite: { + build: { + minify: false, + }, + }, + }); + await fixture.build(); + }); + + after(() => { + fixture.clean(); + }); + + it('generates functions folders inside the project root, and checks that each page is emitted by astro', async () => { + expect(await fixture.pathExists('../functions')).to.be.true; + expect(await fixture.pathExists('../functions/index.js')).to.be.true; + expect(await fixture.pathExists('../functions/blog/cool.js')).to.be.true; + expect(await fixture.pathExists('../functions/blog/[post].js')).to.be.true; + expect(await fixture.pathExists('../functions/[person]/[car].js')).to.be.true; + expect(await fixture.pathExists('../functions/files/[[path]].js')).to.be.true; + expect(await fixture.pathExists('../functions/[language]/files/[[path]].js')).to.be.true; + }); + + it('generates pre-rendered files', async () => { + expect(await fixture.pathExists('./prerender/index.html')).to.be.true; + }); +}); |