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

    Interface INestedOp<R>

    Represents an interface that provides assertion operations for nested properties using dot notation (e.g., "a.b.c").

    0.1.5

    interface INestedOp<R> {
        contain(expected: any, evalMsg?: MsgSource): R;
        contains(expected: any, evalMsg?: MsgSource): R;
        include(expected: any, evalMsg?: MsgSource): R;
        includes(expected: any, evalMsg?: MsgSource): R;
        property(path: string, value?: any, evalMsg?: MsgSource): IPropertyResultOp;
    }

    Type Parameters

    • R

      The type of the result of the operation.

    Index

    Methods

    • Alias for include.

      Parameters

      • expected: any

        The object with properties to match.

      • OptionalevalMsg: MsgSource

        The message to display if the assertion fails.

      Returns R

      The assertion result.

      0.1.5

    • Alias for include.

      Parameters

      • expected: any

        The object with properties to match.

      • OptionalevalMsg: MsgSource

        The message to display if the assertion fails.

      Returns R

      The assertion result.

      0.1.5

    • Asserts that the value contains the expected using nested property matching. Each property in the expected is matched against the value using dot notation.

      Parameters

      • expected: any

        The object with properties to match.

      • OptionalevalMsg: MsgSource

        The message to display if the assertion fails.

      Returns R

      The assertion result.

      0.1.5

      expect({ a: { b: { c: 1 } } }).to.nested.include({ 'a.b.c': 1 });
      expect({ a: { b: { c: 1 } }, d: 2 }).to.nested.include({ 'a.b': { c: 1 } });
    • Alias for include.

      Parameters

      • expected: any

        The object with properties to match.

      • OptionalevalMsg: MsgSource

        The message to display if the assertion fails.

      Returns R

      The assertion result.

      0.1.5

    • Asserts that the object has a nested property using dot notation. When a value is provided, also checks that the property value equals the expected value.

      Parameters

      • path: string

        The dot-separated path to the property (e.g., "a.b.c").

      • Optionalvalue: any

        The expected value of the property (optional).

      • OptionalevalMsg: MsgSource

        The message to display if the assertion fails.

      Returns IPropertyResultOp

      The property result operation for chaining.

      0.1.5

      expect({ a: { b: { c: 1 } } }).to.have.nested.property('a.b.c');
      expect({ a: { b: { c: 1 } } }).to.have.nested.property('a.b.c', 1);
      expect({ a: { b: 2 } }).to.not.have.nested.property('a.b.c');