MCPcopy Create free account
hub / github.com/block/buzz / buildMockChannelWindowAux

Function buildMockChannelWindowAux

desktop/src/testing/e2eBridge.ts:3745–3767  ·  view source on GitHub ↗
(
  events: RelayEvent[],
  rows: RelayEvent[],
)

Source from the content-addressed store, hash-verified

3743}
3744
3745function buildMockChannelWindowAux(
3746 events: RelayEvent[],
3747 rows: RelayEvent[],
3748): RelayEvent[] {
3749 const collectHop = (kinds: Set<number>, targetIds: Set<string>) =>
3750 events.filter(
3751 (event) =>
3752 kinds.has(event.kind) &&
3753 getEventTargets(event).some((target) => targetIds.has(target)),
3754 );
3755
3756 const firstHop = collectHop(
3757 CHANNEL_WINDOW_AUX_KINDS,
3758 new Set(rows.map((row) => row.id)),
3759 );
3760 const secondHop = collectHop(
3761 CHANNEL_WINDOW_AUX_DELETION_KINDS,
3762 new Set(firstHop.map((event) => event.id)),
3763 );
3764 const byId = new Map(firstHop.map((event) => [event.id, event]));
3765 for (const event of secondHop) byId.set(event.id, event);
3766 return [...byId.values()];
3767}
3768
3769function buildMockChannelThreadSummary(
3770 channelId: string,

Callers 1

executeFunction · 0.85

Calls 2

collectHopFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected