summaryrefslogtreecommitdiff
path: root/packages/integrations/cloudflare/test/function-per-route.test.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2023-08-24 10:38:14 -0400
committerGravatar GitHub <noreply@github.com> 2023-08-24 10:38:14 -0400
commitf1c610636a7aeed0a272ab2669815135699b413c (patch)
treed7597c3468197559948f9fe2bafe13a8c3d71106 /packages/integrations/cloudflare/test/function-per-route.test.js
parent608b2d732d762bf1f7f44a82b278caa8853c8c2f (diff)
parentebaccf8c1a2f37eacb6e1957c82fdf7f93b62b08 (diff)
downloadastro-f1c610636a7aeed0a272ab2669815135699b413c.tar.gz
astro-f1c610636a7aeed0a272ab2669815135699b413c.tar.zst
astro-f1c610636a7aeed0a272ab2669815135699b413c.zip
Merge pull request #8188 from withastro/next
Astro 3.0
Diffstat (limited to 'packages/integrations/cloudflare/test/function-per-route.test.js')
-rw-r--r--packages/integrations/cloudflare/test/function-per-route.test.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/packages/integrations/cloudflare/test/function-per-route.test.js b/packages/integrations/cloudflare/test/function-per-route.test.js
new file mode 100644
index 000000000..d20b0fa7c
--- /dev/null
+++ b/packages/integrations/cloudflare/test/function-per-route.test.js
@@ -0,0 +1,35 @@
+import { loadFixture } from './test-utils.js';
+import { expect } from 'chai';
+
+/** @type {import('./test-utils.js').Fixture} */
+describe('Cloudflare SSR functionPerRoute', () => {
+ let fixture;
+
+ before(async () => {
+ fixture = await loadFixture({
+ root: './fixtures/function-per-route/',
+ });
+ 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;
+ expect(await fixture.pathExists('../functions/trpc/[trpc].js')).to.be.true;
+ expect(await fixture.pathExists('../functions/javascript.js')).to.be.true;
+ expect(await fixture.pathExists('../functions/test.json.js')).to.be.true;
+ });
+
+ it('generates pre-rendered files', async () => {
+ expect(await fixture.pathExists('./prerender/index.html')).to.be.true;
+ });
+});