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

x/unitest/matcher/to_contain_value.ts>toContainValue

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

Use .toContainValue when checking if an object contains the provided value

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

const expect = defineExpect({
  matcherMap: {
    toContainValue,
  },
  modifierMap: {
    not,
  },
});

test("passes when object contains given value", () => {
  const object = { a: "foo", b: "bar", c: "baz" };
  expect(object).toContainValue("foo");
  expect(object).toContainValue("bar");
  expect(object).not.toContainValue("qux");
});

Parameters

actual: object
expected: unknown