Skip to main content
Module

x/unitest/mod.ts>toBeEmpty

🃏 Deno-first universal unit testing framework
Latest
function toBeEmpty
Re-export
import { toBeEmpty } from "https://deno.land/x/unitest@v1.0.0-beta.82/mod.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>