From e411f0ae70ae0a4c7d8300560d5e4d32115b67f3 Mon Sep 17 00:00:00 2001 From: acondal Date: Fri, 6 Oct 2023 09:06:10 +0200 Subject: [PATCH] test: response mapper test EMP-2235 --- .../experience-controls.response.ts | 12 ++++++++++++ .../experience-controls-response.mapper.spec.ts | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 packages/x-adapter-platform/src/__tests__/__fixtures__/experience-controls.response.ts create mode 100644 packages/x-adapter-platform/src/mappers/responses/__tests__/experience-controls-response.mapper.spec.ts diff --git a/packages/x-adapter-platform/src/__tests__/__fixtures__/experience-controls.response.ts b/packages/x-adapter-platform/src/__tests__/__fixtures__/experience-controls.response.ts new file mode 100644 index 0000000000..851fab40c9 --- /dev/null +++ b/packages/x-adapter-platform/src/__tests__/__fixtures__/experience-controls.response.ts @@ -0,0 +1,12 @@ +export const platformExperienceControlsResponse = { + numberOfCarousels: 9, + resultsPerCarousels: 24 +}; + +export const experienceControlsResponse = { + controls: { + numberOfCarousels: 9, + resultsPerCarousels: 24 + }, + events: {} +}; diff --git a/packages/x-adapter-platform/src/mappers/responses/__tests__/experience-controls-response.mapper.spec.ts b/packages/x-adapter-platform/src/mappers/responses/__tests__/experience-controls-response.mapper.spec.ts new file mode 100644 index 0000000000..e3e2b9ce56 --- /dev/null +++ b/packages/x-adapter-platform/src/mappers/responses/__tests__/experience-controls-response.mapper.spec.ts @@ -0,0 +1,17 @@ +import { experienceControlsResponseMapper } from '../experience-controls-response.mapper'; +import { PlatformExperienceControlsResponse } from '../../../types'; +import { + experienceControlsResponse, + platformExperienceControlsResponse +} from '../../../__tests__/__fixtures__/experience-controls.response'; + +describe('experienceControlsResponseMapper tests', () => { + it('should map the response', () => { + expect( + experienceControlsResponseMapper( + platformExperienceControlsResponse as unknown as PlatformExperienceControlsResponse, + {} + ) + ).toStrictEqual(experienceControlsResponse); + }); +});