Skip to content

Commit

Permalink
fix(moduels): update entity-test-bed spec
Browse files Browse the repository at this point in the history
  • Loading branch information
zlq4863947 committed Mar 4, 2019
1 parent aad9c3a commit 99644ac
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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}`);
}
});
});

Expand Down

0 comments on commit 99644ac

Please sign in to comment.