@nevware21/tripwire - v0.1.2
    Preparing search index...

    Interface IDeepOp<R>

    Interface for deep assertion operations, it extends several other interfaces to provide a comprehensive set of operations and methods for performing deep equality checks and related operations.

    interface IDeepOp<R> {
        contain: IIncludeOp<R>;
        contains: IIncludeOp<R>;
        eq: EqualFn<R>;
        equal: EqualFn<R>;
        equals: EqualFn<R>;
        include: IIncludeOp<R>;
        includes: IIncludeOp<R>;
        not: IDeepOp;
        own: IOwnOp<R>;
        property: PropertyFn;
        propertyDescriptor: PropertyDescriptorFn;
        strictly: IStrictlyOp<R>;
    }

    Type Parameters

    • R

      The type of the result of the operation.

    Hierarchy (View Summary)

    Index

    Properties

    contain: IIncludeOp<R>

    Provides operations to assert that the value contains a matching value.

    contains: IIncludeOp<R>

    Provides operations to assert that the value contains a matching value.

    eq: EqualFn<R>

    Performs an equality check between the actual and expected values, throwing an AssertionFailure with the given message when the actual value is not equal to the expected value. The default equality check is a loose (==) equality check, to perform a strict equality check (===), use the IStrictlyOp.equal (strictly.equal) operations and when comparing complex objects, use the deep equality operations provided by the IDeepOp.equal (deep.equal) operations or (deep.strictly.equal) for deep strict equality checks. IStrictlyOp.eq (strictly.eq) operations.

    The type of the expected value.

    The expected value.

    The message to display if the values are strictly equal.

    AssertionFailure - If the expected and actual values are strictly equal.

    assert.eq(1, 1); // Passes
    assert.eq("a", "a"); // Passes
    assert.eq(true, true); // Passes
    assert.eq(false, false); // Passes
    assert.eq(null, null); // Passes
    assert.eq(undefined, undefined); // Passes
    assert.eq(0, 0); // Passes
    assert.eq(-0, -0); // Passes
    assert.eq(+0, +0); // Passes
    assert.eq(0n, 0n); // Passes
    assert.eq("", ""); // Passes
    assert.eq(Symbol(), Symbol()); // Passes
    assert.eq([], []); // Throws AssertionError
    assert.eq([1, 2], [1, 2]); // Throws AssertionError
    equal: EqualFn<R>

    Performs an equality check between the actual and expected values, throwing an AssertionFailure with the given message when the actual value is not equal to the expected value. The default equality check is a loose (==) equality check, to perform a strict equality check (===), use the IStrictlyOp.equal (strictly.equal) operations and when comparing complex objects, use the deep equality operations provided by the IDeepOp.equal (deep.equal) operations or (deep.strictly.equal) for deep strict equality checks.

    The type of the expected value.

    The expected value.

    The message to display if the values are not strictly equal.

    AssertionFailure - If the expected and actual values are not strictly equal.

    assert.equal(1, 1); // Passes
    assert.equal("a", "a"); // Passes
    assert.equal(true, true); // Passes
    assert.equal(false, false); // Passes
    assert.equal(null, null); // Passes
    assert.equal(undefined, undefined); // Passes
    assert.equal(0, 0); // Passes
    assert.equal(-0, -0); // Passes
    assert.equal(+0, +0); // Passes
    assert.equal(0n, 0n); // Passes
    assert.equal("", ""); // Passes
    assert.equal(Symbol(), Symbol()); // Passes
    assert.equal([], []); // Throws AssertionError
    assert.equal([1, 2], [1, 2]); // Throws AssertionError
    equals: EqualFn<R>

    Performs an equality check between the actual and expected values, throwing an AssertionFailure with the given message when the actual value is not equal to the expected value. The default equality check is a loose (==) equality check, to perform a strict equality check (===), use the IStrictlyOp.equal (strictly.equal) operations and when comparing complex objects, use the deep equality operations provided by the IDeepOp.equal (deep.equal) operations or (deep.strictly.equal) for deep strict equality checks.

    The type of the expected value.

    The expected value.

    The message to display if the values are strictly equal.

    AssertionFailure - If the expected and actual values are strictly equal.

    assert.equals(1, 1); // Passes
    assert.equals("a", "a"); // Passes
    assert.equals(true, true); // Passes
    assert.equals(false, false); // Passes
    assert.equals(null, null); // Passes
    assert.equals(undefined, undefined); // Passes
    assert.equals(0, 0); // Passes
    assert.equals(-0, -0); // Passes
    assert.equals(+0, +0); // Passes
    assert.equals(0n, 0n); // Passes
    assert.equals("", ""); // Passes
    assert.equals(Symbol(), Symbol()); // Passes
    assert.equals([], []); // Throws AssertionError
    assert.equals([1, 2], [1, 2]); // Throws AssertionError
    include: IIncludeOp<R>

    Provides operations to assert that the value includes a matching value.

    includes: IIncludeOp<R>

    Provides operations to assert that the value includes a matching value.

    not: IDeepOp

    Negates any performed evaluations that are performed in the assertion chain.

    This operation applies a stateful change to the evaluation chain, meaning that subsequent operations that would normally fail will pass without the need for them to "implement" any knowledge about the not operation. You may call not multiple times to negate the negation.

    import { assert } from "@nevware21/tripwire";

    expect(true).not.ok(); // Fails
    expect(false).not.ok(); // Passes
    expect(true).not.not.ok(); // Passes
    expect(false).not.not.ok(); // Fails
    own: IOwnOp<R>

    Provides operations to assert that the evaluation operations exist (are owned) by the current assertion context value.

    property: PropertyFn

    Provides operations to assert that the value has the specified property.

    propertyDescriptor: PropertyDescriptorFn

    Provides operations to assert that the value has the specified property descriptor.

    strictly: IStrictlyOp<R>

    Provides operations to asserts that the value is strictly equal to the specified value.