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

Function getMockMessageStore

desktop/src/testing/e2eBridge.ts:2886–3075  ·  view source on GitHub ↗
(channelId: string)

Source from the content-addressed store, hash-verified

2884}
2885
2886function getMockMessageStore(channelId: string): RelayEvent[] {
2887 const existing = mockMessages.get(channelId);
2888 if (existing) {
2889 return existing;
2890 }
2891
2892 const seeded: RelayEvent[] =
2893 channelId === "9a1657ac-f7aa-5db0-b632-d8bbeb6dfb50"
2894 ? [
2895 {
2896 id: "mock-general-welcome",
2897 pubkey: DEFAULT_MOCK_IDENTITY.pubkey,
2898 created_at: Math.floor(Date.now() / 1000) - 120,
2899 kind: 9,
2900 tags: [["h", channelId]],
2901 content: "Welcome to #general",
2902 sig: "mocksig".repeat(20).slice(0, 128),
2903 },
2904 // Alice authored — gives e2e specs a non-self profile pane to open
2905 // by clicking the second message-row's author button. Used by
2906 // tests/e2e/identity-archive.spec.ts to exercise the admin / OA /
2907 // none-of-the-above branches of the NIP-IA gate. Both seeds are
2908 // backdated (welcome at -120s, Alice at -60s) so user-sent messages
2909 // in other specs always land after both — preserving
2910 // `message-row.first()` = welcome and `.last()` = sent.
2911 {
2912 id: "mock-general-alice",
2913 pubkey: ALICE_PUBKEY,
2914 created_at: Math.floor(Date.now() / 1000) - 60,
2915 kind: 9,
2916 tags: [["h", channelId]],
2917 content: "Hey team — checking in.",
2918 sig: "mocksig".repeat(20).slice(0, 128),
2919 },
2920 // Reaction-target seed for the custom-emoji reaction guard. Real
2921 // 64-hex id so getReactionTargetId() accepts it as a reaction target
2922 // (the short-id seeds above can't be reacted to). Backdated after the
2923 // other seeds, so it stays at row index >= 2 and never displaces
2924 // first()=welcome / nth(1)=alice that other specs rely on.
2925 {
2926 id: REACTION_TARGET_EVENT_ID,
2927 pubkey: ALICE_PUBKEY,
2928 created_at: Math.floor(Date.now() / 1000) - 45,
2929 kind: 9,
2930 tags: [["h", channelId]],
2931 content: REACTION_TARGET_CONTENT,
2932 sig: "mocksig".repeat(20).slice(0, 128),
2933 },
2934 // System-message reaction target. A kind:40099 join event renders via
2935 // SystemMessageRow (testid `system-message-row`, NOT `message-row`),
2936 // so it never displaces the `message-row` index assertions other
2937 // specs rely on. Real 64-hex id so getReactionTargetId() accepts it
2938 // as a reaction target — this is the surface the original "react to a
2939 // system message" bug lived on. Backdated like the other seeds.
2940 {
2941 id: SYSTEM_REACTION_TARGET_EVENT_ID,
2942 pubkey: ALICE_PUBKEY,
2943 created_at: Math.floor(Date.now() / 1000) - 30,

Callers 12

prependMockHistoryFunction · 0.85
emitMockHistoryFunction · 0.85
recordMockMessageFunction · 0.85
emitMockChannelMessageFunction · 0.85
handleGetForumPostsFunction · 0.85
handleGetForumThreadFunction · 0.85
handleGetThreadRepliesFunction · 0.85
executeFunction · 0.85
handleSendChannelMessageFunction · 0.85
handleRemoveReactionFunction · 0.85

Calls 4

buildReplyMessageTagsFunction · 0.85
setMethod · 0.80
getMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected