mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00: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.
|
* If not then thrown.
|
||||||
*/
|
*/
|
||||||
export function assertArrayContains(
|
export function assertArrayContains(
|
||||||
actual: unknown[],
|
actual: ArrayLike<unknown>,
|
||||||
expected: unknown[],
|
expected: ArrayLike<unknown>,
|
||||||
msg?: string
|
msg?: string
|
||||||
): void {
|
): void {
|
||||||
const missing: unknown[] = [];
|
const missing: unknown[] = [];
|
||||||
|
|
|
@ -159,6 +159,10 @@ Deno.test("testingArrayContains", function (): void {
|
||||||
const fixtureObject = [{ deno: "luv" }, { deno: "Js" }];
|
const fixtureObject = [{ deno: "luv" }, { deno: "Js" }];
|
||||||
assertArrayContains(fixture, ["deno"]);
|
assertArrayContains(fixture, ["deno"]);
|
||||||
assertArrayContains(fixtureObject, [{ deno: "luv" }]);
|
assertArrayContains(fixtureObject, [{ deno: "luv" }]);
|
||||||
|
assertArrayContains(
|
||||||
|
Uint8Array.from([1, 2, 3, 4]),
|
||||||
|
Uint8Array.from([1, 2, 3])
|
||||||
|
);
|
||||||
assertThrows(
|
assertThrows(
|
||||||
(): void => assertArrayContains(fixtureObject, [{ deno: "node" }]),
|
(): void => assertArrayContains(fixtureObject, [{ deno: "node" }]),
|
||||||
AssertionError,
|
AssertionError,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue