Skip to main content
Module

x/unitest/mod.ts>toHaveLength

🃏 Deno-first universal unit testing framework
Latest
function toHaveLength
Re-export
import { toHaveLength } from "https://deno.land/x/unitest@v1.0.0-beta.82/mod.ts";

Use .toHaveLength to check that an object has a .length property and it is set to a certain numeric value

import { expect, test } from "https://deno.land/x/unitest@$VERSION/mod.ts";

test("passes when object of length property equal to", () => {
  expect([1, 2, 3]).toHaveLength(3);
  expect("abc").toHaveLength(3);
  expect("").not.toHaveLength(5);
});

Parameters

unnamed 0: { length?: number; }
expected: number