jstests/libs/change_stream_util.js
/**
     * Asserts that the last observed change was the change we expect to see. This also asserts
     * that if we do not expect the cursor to be invalidated, that we do not see the cursor
     * invalidated. Omits the observed change's resume token and cluster time from the comparison,
     * unless the expected change explicitly lists an '_id' or 'clusterTime' field to compare
     * against.
     */
Asserts that the last observed change was the change we expect to see. This also asserts
that if we do not expect the cursor to be invalidated, that we do not see the cursor
invalidated.
Asserts that the last observed change was the change we expect to see . This also asserts that if we do not expect the cursor to be invalidated that we do not see the cursor invalidated .
function assertChangeIsExpected(
        expectedChanges, numChangesSeen, observedChanges, expectInvalidate) {
        if (expectedChanges) {
            assertChangeStreamEventEq(observedChanges[numChangesSeen],
                                      expectedChanges[numChangesSeen]);
        } else if (!expectInvalidate) {
            assert(!isInvalidated(observedChanges[numChangesSeen]),
                   "Change was invalidated when it should not have been. Number of changes seen: " +
                       numChangesSeen + ", observed changes: " + tojson(observedChanges) +
                       ", expected changes: " + tojson(expectedChanges));
        }
    }
function assertChangeIsExpected ( expectedChanges , numChangesSeen , observedChanges , expectInvalidate ) { if ( expectedChanges ) { assertChangeStreamEventEq ( observedChanges [ numChangesSeen ] , expectedChanges [ numChangesSeen ] ) ; } else if ( ! expectInvalidate ) { assert ( ! isInvalidated ( observedChanges [ numChangesSeen ] ) , "Change was invalidated when it should not have been. Number of changes seen: " + numChangesSeen + ", observed changes: " + tojson ( observedChanges ) + ", expected changes: " + tojson ( expectedChanges ) ) ; } }
Asserts that the last observed change was the change we expect to see.
Asserts that the last observed change was the change we expect to see .