Skip to content

Commit

Permalink
Add tests for base
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Jul 26, 2024
1 parent 4b5108b commit 2c00d96
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import nodejs from '@astrojs/node';

// https://astro.build/config
export default defineConfig({
base: '/base',
output: 'hybrid',
adapter: nodejs({ mode: 'standalone' }),
integrations: [react(), mdx()],
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/e2e/server-islands.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ test.describe('Server islands', () => {
});

test('Load content from the server', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
await page.goto(astro.resolveUrl('/base/'));
let el = page.locator('#island');

await expect(el, 'element rendered').toBeVisible();
await expect(el, 'should have content').toHaveText('I am an island');
});

test('Can be in an MDX file', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/mdx/'));
await page.goto(astro.resolveUrl('/base/mdx/'));
let el = page.locator('#island');

await expect(el, 'element rendered').toBeVisible();
await expect(el, 'should have content').toHaveText('I am an island');
});

test('Slots are provided back to the server islands', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
await page.goto(astro.resolveUrl('/base/'));
let el = page.locator('#children');

await expect(el, 'element rendered').toBeVisible();
Expand All @@ -55,7 +55,7 @@ test.describe('Server islands', () => {
});

test('Only one component in prod', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
await page.goto(astro.resolveUrl('/base/'));

let el = page.locator('#island');

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/render/server-islands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ let data = {
slots: ${safeJsonStringify(renderedSlots)},
};
let response = await fetch('${serverIslandUrl}'), {
let response = await fetch('${serverIslandUrl}', {
method: 'POST',
body: JSON.stringify(data),
});
Expand Down

0 comments on commit 2c00d96

Please sign in to comment.