From b25179e9699322eb15fdb258569d6073d161cb73 Mon Sep 17 00:00:00 2001 From: Pascal Kaufmann Date: Mon, 21 Oct 2024 23:44:12 +0200 Subject: [PATCH] Fix async test problem --- .../src/module/buildFindSelector.test.ts | 44 +++++++++---------- .../src/module/configureEventsModule.ts | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/core-events/src/module/buildFindSelector.test.ts b/packages/core-events/src/module/buildFindSelector.test.ts index 5a8a341b28..95f9cc9dbf 100644 --- a/packages/core-events/src/module/buildFindSelector.test.ts +++ b/packages/core-events/src/module/buildFindSelector.test.ts @@ -2,29 +2,29 @@ import { buildFindSelector } from "./configureEventsModule.js"; describe('Event', () => { describe('buildFindSelector', () => { - it('Return correct filter object when passed create, queryString, types', () => { - expect(buildFindSelector({created: new Date("2022-12-03T18:23:38.278Z"), queryString: "Hello world", types: ['PRODUCT_CREATED']})).toEqual({ - type: { '$in': [ 'PRODUCT_CREATED' ] }, - '$text': { '$search': 'Hello world' }, - created: { '$gte': new Date( "2022-12-03T18:23:38.278Z" )} - }) - }); + it('Return correct filter object when passed create, queryString, types', () => { + expect(buildFindSelector({created: new Date("2022-12-03T18:23:38.278Z"), queryString: "Hello world", types: ['PRODUCT_CREATED']})).toEqual({ + type: { '$in': [ 'PRODUCT_CREATED' ] }, + '$text': { '$search': 'Hello world' }, + created: { '$gte': new Date( "2022-12-03T18:23:38.278Z" )} + }) + }); - it('Return correct filter object when passed create, queryString', () => { - expect(buildFindSelector({created: new Date("2022-12-03T18:23:38.278Z"), queryString: "Hello world"})).toEqual({ - '$text': { '$search': 'Hello world' }, - created: { '$gte': new Date( "2022-12-03T18:23:38.278Z" )} - }) - }); + it('Return correct filter object when passed create, queryString', () => { + expect(buildFindSelector({created: new Date("2022-12-03T18:23:38.278Z"), queryString: "Hello world"})).toEqual({ + '$text': { '$search': 'Hello world' }, + created: { '$gte': new Date( "2022-12-03T18:23:38.278Z" )} + }) + }); - it('Return correct filter object when passed create', () => { - expect(buildFindSelector({created: new Date("2022-12-03T18:23:38.278Z")})).toEqual({ - created: { '$gte': new Date( "2022-12-03T18:23:38.278Z" )} - }) - }); + it('Return correct filter object when passed create', () => { + expect(buildFindSelector({created: new Date("2022-12-03T18:23:38.278Z")})).toEqual({ + created: { '$gte': new Date( "2022-12-03T18:23:38.278Z" )} + }) + }); - it('Return correct filter object when passed no argument', () => { - expect(buildFindSelector({})).toEqual({}) - }); -}) + it('Return correct filter object when passed no argument', () => { + expect(buildFindSelector({})).toEqual({}) + }); + }) }); diff --git a/packages/core-events/src/module/configureEventsModule.ts b/packages/core-events/src/module/configureEventsModule.ts index cb36dae632..100c5b3a5d 100644 --- a/packages/core-events/src/module/configureEventsModule.ts +++ b/packages/core-events/src/module/configureEventsModule.ts @@ -62,7 +62,7 @@ export const configureEventsModule = async ({ return result.insertedId as string; }; - configureEventHistoryAdapter(create); + await configureEventHistoryAdapter(create); return { create,