From 6eff5c353151afd84a55cefd8e01684c7a374310 Mon Sep 17 00:00:00 2001 From: Tim van Oostrom Date: Thu, 9 Jan 2025 15:58:27 +0100 Subject: [PATCH] Fix tests --- src/server/helpers/source-api-request.test.ts | 2 +- src/server/services/controller.test.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/helpers/source-api-request.test.ts b/src/server/helpers/source-api-request.test.ts index fb60edc8b9..1c252a8672 100644 --- a/src/server/helpers/source-api-request.test.ts +++ b/src/server/helpers/source-api-request.test.ts @@ -213,7 +213,7 @@ describe('requestData.ts', () => { ); expect(axiosRequestSpy).toHaveBeenCalledTimes(0); - expect(rs).toStrictEqual(apiPostponeResult()); + expect(rs).toStrictEqual(apiPostponeResult(null)); }); it('A requests responds with error', async () => { diff --git a/src/server/services/controller.test.ts b/src/server/services/controller.test.ts index 6a8661f148..0c19eb36e7 100644 --- a/src/server/services/controller.test.ts +++ b/src/server/services/controller.test.ts @@ -22,6 +22,7 @@ import { RequestMock, ResponseMock, } from '../../testing/utils'; +import { apiSuccessResult } from '../../universal/helpers/api'; const mocks = vi.hoisted(() => { return { @@ -188,7 +189,7 @@ describe('controller', () => { test('addServiceResultHandler', async () => { const resMock = ResponseMock.new(); - const data = { foo: 'bar' }; + const data = { X: apiSuccessResult({ foo: 'bar' }) }; const servicePromise = Promise.resolve(data); const result = await addServiceResultHandler( @@ -198,7 +199,7 @@ describe('controller', () => { ); expect(resMock.write).toHaveBeenCalledWith( - `event: message\nid: test-service\ndata: {"foo":"bar"}\n\n` + `event: message\nid: test-service\ndata: {"X":{"content":{"foo":"bar"},"status":"OK"}}\n\n` ); expect(result).toEqual(data);