mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
fix(std/testing) assertArrayContains should work with any array-like (#6402)
This commit is contained in:
parent
1d8fc39494
commit
f318ab01a4
2 changed files with 6 additions and 2 deletions
|
@ -269,8 +269,8 @@ export function assertStringContains(
|
|||
* If not then thrown.
|
||||
*/
|
||||
export function assertArrayContains(
|
||||
actual: unknown[],
|
||||
expected: unknown[],
|
||||
actual: ArrayLike<unknown>,
|
||||
expected: ArrayLike<unknown>,
|
||||
msg?: string
|
||||
): void {
|
||||
const missing: unknown[] = [];
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue