Skip to content

Commit

Permalink
Fix async test problem
Browse files Browse the repository at this point in the history
  • Loading branch information
pozylon committed Oct 21, 2024
1 parent 664af52 commit b25179e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
44 changes: 22 additions & 22 deletions packages/core-events/src/module/buildFindSelector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({})
});
})
});
2 changes: 1 addition & 1 deletion packages/core-events/src/module/configureEventsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const configureEventsModule = async ({
return result.insertedId as string;
};

configureEventHistoryAdapter(create);
await configureEventHistoryAdapter(create);

return {
create,
Expand Down

0 comments on commit b25179e

Please sign in to comment.