Skip to content

Commit 41c2cfe

Browse files
committed
test: refactor try catch with arrow function
1 parent f511059 commit 41c2cfe

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/discriminators/merge-customization-options/__tests__/mergeCustomizationOptions.test.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,17 +226,11 @@ describe('mergeCustomizationOptions()', () => {
226226
});
227227

228228
it('should produce error if using different schema composers', () => {
229-
try {
230-
const mergedOpts = mergeCustomizationOptions(
229+
expect(() => {
230+
mergeCustomizationOptions(
231231
{ schemaComposer: new SchemaComposer() },
232232
{ schemaComposer: new SchemaComposer() }
233233
);
234-
235-
expect(mergedOpts).toBeFalsy();
236-
} catch (error) {
237-
expect(error.message).toBe(
238-
'[Discriminators] ChildModels should have same schemaComposer as its BaseModel'
239-
);
240-
}
234+
}).toThrow('[Discriminators] ChildModels should have same schemaComposer as its BaseModel');
241235
});
242236
});

0 commit comments

Comments
 (0)