MCPcopy
hub / github.com/mongodb/node-mongodb-native / matchesEvents

Function matchesEvents

test/tools/unified-spec-runner/match.ts:682–704  ·  view source on GitHub ↗
(
  { events: expected, ignoreExtraEvents }: ExpectedEventsForClient,
  actual: CommandEvent[] | CmapEvent[] | SdamEvent[],
  entities: EntitiesMap
)

Source from the content-addressed store, hash-verified

680}
681
682export function matchesEvents(
683 { events: expected, ignoreExtraEvents }: ExpectedEventsForClient,
684 actual: CommandEvent[] | CmapEvent[] | SdamEvent[],
685 entities: EntitiesMap
686): void {
687 ignoreExtraEvents = ignoreExtraEvents ?? false;
688
689 if (ignoreExtraEvents) {
690 if (actual.length < expected.length) {
691 failOnMismatchedCount(actual, expected);
692 }
693
694 const slicedActualEvents = actual.slice(0, expected.length);
695
696 compareEvents(slicedActualEvents, expected, entities);
697 } else {
698 if (actual.length !== expected.length) {
699 failOnMismatchedCount(actual, expected);
700 }
701
702 compareEvents(actual, expected, entities);
703 }
704}
705
706export function filterIgnoredMessages(
707 logsToIgnore: ExpectedLogMessage[],

Callers 2

getMatchingEventCountFunction · 0.90
runUnifiedTestFunction · 0.90

Calls 2

failOnMismatchedCountFunction · 0.85
compareEventsFunction · 0.85

Tested by

no test coverage detected