import { toBeEmpty } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/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>