core3-utils

@wixc3/mostly-equal on Github

Home > @wixc3/mostly-equal > defineUnique

defineUnique() function

Creates a symbol for usage in expect.mostlyEqual, Comparing the resulting value in any place it is used as the value

Signature:

defineUnique: (name: string, skipUndefined?: boolean) => import("./types").MarkerSymbol

Parameters

Parameter Type Description
name string error display name
skipUndefined boolean _(Optional)_ ignores undefined values, even for multiple instances

Returns:

import(“./types”).MarkerSymbol

Example

const id = defineUnique('id');
expect({
      a: 'a',
      b: 'b',
  }).to.mostlyEqual({
      a: id,
      b: id
  }); // will pass