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

    Interface IIncludeOp<R>

    Represents the include operations for the assertion scope.

    0.1.2

    interface IIncludeOp<R> {
        all: IAllOp<R>;
        any: IAnyOp<R>;
        endsWithMembers(expected: ArrayLikeOrSizedIterable, evalMsg?: MsgSource): R;
        members(expected: ArrayLikeOrSizedIterable, evalMsg?: MsgSource): R;
        orderedMembers(expected: ArrayLikeOrSizedIterable, evalMsg?: MsgSource): R;
        sameMembers(expected: ArrayLikeOrSizedIterable, evalMsg?: MsgSource): R;
        sameOrderedMembers(
            expected: ArrayLikeOrSizedIterable,
            evalMsg?: MsgSource,
        ): R;
        startsWithMembers(
            expected: ArrayLikeOrSizedIterable,
            evalMsg?: MsgSource,
        ): R;
        subsequence(expected: ArrayLikeOrSizedIterable, evalMsg?: MsgSource): R;
        (match: any, evalMsg?: MsgSource): R;
    }

    Type Parameters

    • R

      The type of the result of the operation.

    Hierarchy (View Summary)

    Index

    Properties

    all: IAllOp<R>

    Provides access to additional operations based on the IAnyOp interface for the assertion scope.

    any: IAnyOp<R>

    Provides access to additional operations based on the IAllOp interface for the assertion scope.

    Methods

    • Asserts that the target collection includes all members of the expected collection in the same order (but may have additional members in between). Uses strict equality (===) for comparison. Both target and expected must conform to ArrayLikeOrSizedIterable but can be different concrete types.

      Parameters

      Returns R

      0.1.5

      expect([1, 2, 3, 4]).includes.orderedMembers([1, 2, 3]);  // Passes
      expect([1, 2, 3, 4]).includes.orderedMembers([2, 4]); // Passes - with gaps
      expect([1, 2, 3, 4]).includes.orderedMembers([3, 2]); // Fails - wrong order
    • Asserts that the target collection has the same members as the expected collection, regardless of order. Uses deep equality when in deep context, strict equality otherwise. Both target and expected must conform to ArrayLikeOrSizedIterable but can be different concrete types.

      Parameters

      Returns R

      0.1.5

      expect([{a: 1}, {b: 2}]).has.deep.include.sameMembers([{b: 2}, {a: 1}]);  // Passes
      expect([[1, 2], [3, 4]]).has.deep.include.sameMembers([[3, 4], [1, 2]]); // Passes
    • Asserts that the target collection has the same members in the same order as the expected collection. Uses deep equality when in deep context, strict equality otherwise. Both target and expected must conform to ArrayLikeOrSizedIterable but can be different concrete types.

      Parameters

      Returns R

      0.1.5

      expect([{a: 1}, {b: 2}]).has.deep.include.sameOrderedMembers([{a: 1}, {b: 2}]);  // Passes
      expect([{a: 1}, {b: 2}]).has.deep.include.sameOrderedMembers([{b: 2}, {a: 1}]); // Fails - different order
    • Asserts that the target collection contains a subsequence matching the expected members. The members must appear in the specified order but don't need to be consecutive - other elements can appear between them. Uses deep equality when in deep context, strict equality otherwise. Both target and expected must conform to ArrayLikeOrSizedIterable but can be different concrete types.

      Parameters

      Returns R

      0.1.5

      expect([1, 2, 3, 4, 5]).includes.subsequence([2, 4, 5]);  // Passes - in order with gaps
      expect([1, 2, 3, 4, 5]).includes.subsequence([5, 3, 1]); // Fails - wrong order
      expect([{a: 1}, {b: 2}, {c: 3}]).deep.includes.subsequence([{a: 1}, {c: 3}]); // Passes with deep equality