Skip to content

Commit

Permalink
fix(core): respect disableContextResolution option when forking
Browse files Browse the repository at this point in the history
This got broken with #4717.

Closes #3338
  • Loading branch information
B4nan committed Oct 2, 2023
1 parent e79ff42 commit 5964e52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/EntityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ export class EntityManager<D extends IDatabaseDriver = IDatabaseDriver> {

fork.filters = { ...em.filters };
fork.filterParams = Utils.copy(em.filterParams);
fork._schema = options.schema ?? em.schema;
fork._schema = options.schema ?? em._schema;

if (!options.clear) {
for (const entity of em.unitOfWork.getIdentityMap()) {
Expand Down
4 changes: 2 additions & 2 deletions tests/EntityManager.mongo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,10 @@ describe('EntityManagerMongo', () => {

const spy = jest.spyOn(EntityManager.prototype, 'getContext');
const fork2 = orm.em.fork({ disableContextResolution: true });
expect(spy).toBeCalledTimes(3);
expect(spy).toBeCalledTimes(2);

const fork3 = orm.em.fork({ disableContextResolution: false });
expect(spy).toBeCalledTimes(7);
expect(spy).toBeCalledTimes(5);
});

test('findOne with empty where will throw', async () => {
Expand Down

0 comments on commit 5964e52

Please sign in to comment.