summaryrefslogtreecommitdiff
path: root/packages/astro/test/ssr-dynamic.test.js
diff options
context:
space:
mode:
authorGravatar Johannes Spohr <johannes@spohr.me> 2023-05-19 16:52:46 +0200
committerGravatar GitHub <noreply@github.com> 2023-05-19 10:52:46 -0400
commit72f686a68930de52f9a274c13c98acad59925b31 (patch)
tree509f533f17e83987e0b86b47ed9848efa431ac79 /packages/astro/test/ssr-dynamic.test.js
parented4aff0cb99c1a76077be3ab6dd44c0fdae02bf3 (diff)
downloadastro-72f686a68930de52f9a274c13c98acad59925b31.tar.gz
astro-72f686a68930de52f9a274c13c98acad59925b31.tar.zst
astro-72f686a68930de52f9a274c13c98acad59925b31.zip
Fix injectRoute for SSR (#7128)
* Use manifest routes for SSR app manifest instead of page components to enable injected routes with SSR * Small refactoring Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> --------- Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Diffstat (limited to '')
-rw-r--r--packages/astro/test/ssr-dynamic.test.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/astro/test/ssr-dynamic.test.js b/packages/astro/test/ssr-dynamic.test.js
index a75ace7e3..e4bb61b4a 100644
--- a/packages/astro/test/ssr-dynamic.test.js
+++ b/packages/astro/test/ssr-dynamic.test.js
@@ -11,6 +11,19 @@ describe('Dynamic pages in SSR', () => {
fixture = await loadFixture({
root: './fixtures/ssr-dynamic/',
output: 'server',
+ integrations: [
+ {
+ name: 'inject-routes',
+ hooks: {
+ 'astro:config:setup': ({ injectRoute }) => {
+ injectRoute({
+ pattern: '/path-alias/[id]',
+ entryPoint: './src/pages/api/products/[id].js',
+ });
+ },
+ },
+ },
+ ],
adapter: testAdapter(),
});
await fixture.build();
@@ -55,6 +68,11 @@ describe('Dynamic pages in SSR', () => {
expect(json.id).to.equal('33');
});
+ it('Injected route work', async () => {
+ const json = await fetchJSON('/path-alias/33');
+ expect(json.id).to.equal('33');
+ });
+
it('Public assets take priority', async () => {
const favicon = await matchRoute('/favicon.ico');
expect(favicon).to.equal(undefined);