-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add server error integration test (#146)
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
packages/test-integration/test/PreviewProcessInternalServerError.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { expect, test } from '@jest/globals' | ||
import getPort from 'get-port' | ||
import { createPreviewProcess } from '../src/parts/CreatePreviewProcess/CreatePreviewProcess.js' | ||
import { get } from '../src/parts/Get/Get.js' | ||
import { getRoot } from '../src/parts/GetRoot/GetRoot.js' | ||
|
||
test.skip('preview process - internal server error', async () => { | ||
const previewProcess = createPreviewProcess() | ||
const id = 1 | ||
const port = await getPort() | ||
const root = getRoot() | ||
|
||
await previewProcess.invoke('WebViewServer.create', id) | ||
await previewProcess.invoke('WebViewServer.setHandler', id, '', root, '', '') | ||
await previewProcess.invoke('WebViewServer.start', id, port) | ||
|
||
// Using a special path that triggers internal server error in the preview process | ||
const response = await get(`http://localhost:${port}/__internal_error__`) | ||
expect(response.status).toBe(500) | ||
expect(await response.text()).toBe('500 - Internal Server Error') | ||
|
||
previewProcess[Symbol.dispose]() | ||
}) |