Skip to content

Commit

Permalink
Use expect and toThrow instead of try-catch
Browse files Browse the repository at this point in the history
aws#13810

This is to fix a linter error. The linter prefers expect and toThrow
over try-catch when statements in tests are expected to throw.
  • Loading branch information
douglasnaphas committed Jul 18, 2021
1 parent 9091b1d commit cbaffe7
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,9 @@ describe('ClientVpnAuthorizationRule constructor', () => {
);
});
test('invalid constructor calls should not add anything to the stack', () => {
try {
expect(() => {
new ClientVpnAuthorizationRule(stack, 'InvalidRule', { cidr: '10.0.10.0/32' });
} catch {
expect(stack.node.children.length).toBe(1);
}
}).toThrow();
expect(stack.node.children.length).toBe(1);
});
});

0 comments on commit cbaffe7

Please sign in to comment.