From 9f3cff7ba84aac32ef06195d186a279df95bee96 Mon Sep 17 00:00:00 2001 From: Le Vivilet <72156503+levivilet@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:13:52 +0100 Subject: [PATCH] feature: add server error integration test (#146) --- .../PreviewProcessInternalServerError.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packages/test-integration/test/PreviewProcessInternalServerError.test.ts diff --git a/packages/test-integration/test/PreviewProcessInternalServerError.test.ts b/packages/test-integration/test/PreviewProcessInternalServerError.test.ts new file mode 100644 index 00000000..116c3d19 --- /dev/null +++ b/packages/test-integration/test/PreviewProcessInternalServerError.test.ts @@ -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]() +})