prefer "expect(...).toThrow" over "try ... catch" in tests

This addresses the same issue mentioned in #16 and #18. This version places the expectation on the behavior rather than relying on error handling in the body of the test.