Skip to content

Commit

Permalink
fix(core): throw when trying to call em.remove(..., null)
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Aug 9, 2020
1 parent 8c45339 commit 77c52dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/EntityManager.mysql.test.ts
Expand Up @@ -1903,6 +1903,11 @@ describe('EntityManagerMySql', () => {
orm.em.clear();
});

test('em.remove() with null or undefined in where parameter throws', async () => {
expect(() => orm.em.remove(Book2, undefined as any)).toThrowError(`You cannot call 'EntityManager.remove()' with empty 'where' parameter. If you want to remove all entities, use 'em.remove(Book2, {})'.`);
expect(() => orm.em.remove(Book2, null)).toThrowError(`You cannot call 'EntityManager.remove()' with empty 'where' parameter. If you want to remove all entities, use 'em.remove(Book2, {})'.`);
});

afterAll(async () => orm.close(true));

});

0 comments on commit 77c52dd

Please sign in to comment.