From aaa2ed5a6450572d90fdb3fc2f0000759599d46f Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Wed, 3 Jun 2020 04:38:46 +0100 Subject: fix(std/testing/asserts): Format values in assertArrayContains() (#6060) --- std/testing/asserts_test.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'std/testing/asserts_test.ts') diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts index fb25d46cf..c333d41da 100644 --- a/std/testing/asserts_test.ts +++ b/std/testing/asserts_test.ts @@ -151,15 +151,11 @@ test("testingArrayContains", function (): void { const fixtureObject = [{ deno: "luv" }, { deno: "Js" }]; assertArrayContains(fixture, ["deno"]); assertArrayContains(fixtureObject, [{ deno: "luv" }]); - let didThrow; - try { - assertArrayContains(fixtureObject, [{ deno: "node" }]); - didThrow = false; - } catch (e) { - assert(e instanceof AssertionError); - didThrow = true; - } - assertEquals(didThrow, true); + assertThrows( + (): void => assertArrayContains(fixtureObject, [{ deno: "node" }]), + AssertionError, + `actual: "[ { deno: "luv" }, { deno: "Js" } ]" expected to contain: "[ { deno: "node" } ]"\nmissing: [ { deno: "node" } ]` + ); }); test("testingAssertStringContainsThrow", function (): void { -- cgit v1.2.3