Skip to content

Commit

Permalink
fix: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Aug 21, 2024
1 parent 9e72229 commit 418041b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 45 deletions.
2 changes: 1 addition & 1 deletion test/ui/src/content/tutorial/tests/preview/meta.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
type: chapter
title: Preview
mainCommand: 'pnpm start'
mainCommand: 'node ./index.mjs'
---
14 changes: 0 additions & 14 deletions test/ui/src/templates/default/about.html

This file was deleted.

14 changes: 0 additions & 14 deletions test/ui/src/templates/default/index.html

This file was deleted.

5 changes: 2 additions & 3 deletions test/ui/src/templates/default/index.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import http from 'node:http';
import { readFileSync } from 'node:fs';

const server = http.createServer((req, res) => {
if (req.url === '/' || req.url === '/index.html') {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(readFileSync('./index.html', 'utf8'));
res.end('Index page');

return;
}

if (req.url === '/about.html') {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(readFileSync('./about.html'));
res.end('About page');

return;
}
Expand Down
9 changes: 0 additions & 9 deletions test/ui/src/templates/default/package.json

This file was deleted.

7 changes: 3 additions & 4 deletions test/ui/test/preview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ test('user can see single preview tab', async ({ page }) => {
await expect(page.getByText('Node Server')).toBeVisible();

const preview = page.frameLocator('[title="Node Server"]');
await expect(preview.getByText('Default template')).toBeVisible();
await expect(preview.getByText('Index')).toBeVisible();
await expect(preview.getByText('Index page')).toBeVisible();
});

test('user can see multiple preview tabs', async ({ page }) => {
Expand All @@ -22,6 +21,6 @@ test('user can see multiple preview tabs', async ({ page }) => {
await expect(page.getByText('First Server')).toBeVisible();
await expect(page.getByText('Second Server')).toBeVisible();

await expect(page.frameLocator('[title="First Server"]').getByText('Index')).toBeVisible({ timeout: 10_000 });
await expect(page.frameLocator('[title="Second Server"]').getByText('About')).toBeVisible({ timeout: 10_000 });
await expect(page.frameLocator('[title="First Server"]').getByText('Index page')).toBeVisible({ timeout: 10_000 });
await expect(page.frameLocator('[title="Second Server"]').getByText('About page')).toBeVisible({ timeout: 10_000 });
});

0 comments on commit 418041b

Please sign in to comment.