From f318ab01a47cecac9df62d11cb0c745f39523da9 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Wed, 24 Jun 2020 20:29:50 +0800 Subject: fix(std/testing) assertArrayContains should work with any array-like (#6402) --- std/testing/asserts.ts | 4 ++-- std/testing/asserts_test.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'std') diff --git a/std/testing/asserts.ts b/std/testing/asserts.ts index 50c45c6ca..ea15aa6bc 100644 --- a/std/testing/asserts.ts +++ b/std/testing/asserts.ts @@ -269,8 +269,8 @@ export function assertStringContains( * If not then thrown. */ export function assertArrayContains( - actual: unknown[], - expected: unknown[], + actual: ArrayLike, + expected: ArrayLike, msg?: string ): void { const missing: unknown[] = []; diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts index 8b79ddf8a..35ce50031 100644 --- a/std/testing/asserts_test.ts +++ b/std/testing/asserts_test.ts @@ -159,6 +159,10 @@ Deno.test("testingArrayContains", function (): void { const fixtureObject = [{ deno: "luv" }, { deno: "Js" }]; assertArrayContains(fixture, ["deno"]); assertArrayContains(fixtureObject, [{ deno: "luv" }]); + assertArrayContains( + Uint8Array.from([1, 2, 3, 4]), + Uint8Array.from([1, 2, 3]) + ); assertThrows( (): void => assertArrayContains(fixtureObject, [{ deno: "node" }]), AssertionError, -- cgit v1.2.3