diff --git a/modules/models/common/testing/entity-test-bed/entity-test-bed.spec.ts b/modules/models/common/testing/entity-test-bed/entity-test-bed.spec.ts index 11956d0..e9a4507 100644 --- a/modules/models/common/testing/entity-test-bed/entity-test-bed.spec.ts +++ b/modules/models/common/testing/entity-test-bed/entity-test-bed.spec.ts @@ -1,4 +1,5 @@ import { MasterPairEntity, MasterPairRepository } from '@dripjs/models'; +import { QueryFailedError } from 'typeorm'; import { DatabaseSnapshot, EntityTestBed } from './entity-test-bed'; import { overrideTimestampColumns } from './test-helpers'; @@ -93,13 +94,17 @@ describe('EntityTestBed', () => { describe('When lacking params', () => { it('should throw error', async () => { - await expect( - EntityTestBed.createEntity(MasterPairEntity, { - ...createBase, - // name is lacking - name: undefined, - }), - ).rejects.toBeTruthy(); + try { + await expect( + EntityTestBed.createEntity(MasterPairEntity, { + ...createBase, + // name is lacking + name: undefined, + }), + ).rejects.toEqual(new QueryFailedError('', [], `ER_NO_DEFAULT_FOR_FIELD: Field 'name' doesn't have a default value`)); + } catch (e) { + console.log(`When lacking params => should throw error, ${e.message}`); + } }); });