core3-utils

@wixc3/mostly-equal on Github

Home > @wixc3/mostly-equal > defineSame

defineSame() function

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

Signature:

defineSame: (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 = defineSame('id');
expect({
      a: 'a',
      b: 'b',
  }).to.mostlyEqual({
      a: id,
      b: id
  }); // will fail