Skip to content

Commit

Permalink
test plain text responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 9, 2022
1 parent 8d7476e commit 8c12306
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/kit/test/apps/options/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ test.describe.configure({ mode: 'parallel' });

test.describe('base path', () => {
test('serves a useful 404 when visiting unprefixed path', async ({ request }) => {
const response = await request.get('/slash/', { headers: { Accept: 'text/html' } });
expect(response.status()).toBe(404);
expect(await response.text()).toBe(
const html = await request.get('/slash/', { headers: { Accept: 'text/html' } });
expect(html.status()).toBe(404);
expect(await html.text()).toBe(
'Not found (did you mean <a href="/path-base/slash/">/path-base/slash/</a>?)'
);

const plain = await request.get('/slash/');
expect(plain.status()).toBe(404);
expect(await plain.text()).toBe('Not found (did you mean /path-base/slash/?)');
});

test('serves /', async ({ page, javaScriptEnabled }) => {
Expand Down

0 comments on commit 8c12306

Please sign in to comment.