Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/unitest/matcher/to_be_empty.ts>toBeEmpty

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

Use .toBeEmpty when checking if a String '', Array [], Object {}, or Iterable is empty

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

const expect = defineExpect({
  matcherMap: {
    toBeEmpty,
  },
});

test("passes when given an empty", () => {
  expect("").toBeEmpty();
  expect([]).toBeEmpty();
  expect({}).toBeEmpty();
  expect(new Map()).toBeEmpty();
});

Parameters

actual: Iterable<T> | Record<PropertyKey, unknown>