From 5afb4f3360fac54d78abb0326952cb64653e2179 Mon Sep 17 00:00:00 2001 From: "Michael D. Norman" Date: Mon, 13 Apr 2020 21:47:55 -0500 Subject: [PATCH] fix spec --- spec/unit/services/helloWorld.spec.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/spec/unit/services/helloWorld.spec.ts b/spec/unit/services/helloWorld.spec.ts index f78fe25e..f256ee62 100644 --- a/spec/unit/services/helloWorld.spec.ts +++ b/spec/unit/services/helloWorld.spec.ts @@ -52,15 +52,8 @@ describe('helloWorld', () => { describe('with bad input', () => { it('should throw error', async () => { - try { - const result = await helloWorld('BAD!'); - fail(`No error thrown. Got result: ${result}`); - } catch (e) { - expect(e).not.toBeNull(); - expect(e).toEqual(jasmine.any(ArgumentError)); - expect(e.message).toContain('Bad word given'); - expect(e.message).toContain('BAD!'); - } + await expect(helloWorld('BAD!')).rejects.toThrowError('Bad word given'); + await expect(helloWorld('BAD!')).rejects.toThrowError('BAD!'); }); }); });