Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(threadSlice): cover merging persisted channel activity

Steven Enamakel3ec7d0794d7c
diff --git a/app/src/store/__tests__/threadSlice.test.ts b/app/src/store/__tests__/threadSlice.test.ts
index 0b634eda9a..2f31eaed79 100644
--- a/app/src/store/__tests__/threadSlice.test.ts
+++ b/app/src/store/__tests__/threadSlice.test.ts
@@ -89,7 +89,15 @@ describe('threadSlice synchronous reducers', () => {
it('applies provider reactions only to the exact OpenHuman row and persists read state in metadata', async () => {
const store = createStore();
- const message = makeMessage({ id: 'user:row-42' });
+ const message = makeMessage({
+ id: 'user:row-42',
+ extraMetadata: {
+ channelActivity: {
+ reactions: { 'persisted-reaction': { actorId: 'bob', value: 'πŸŽ‰' } },
+ readReceipts: { 'persisted-receipt': { actorId: 'carol', timestamp: 123 } },
+ },
+ },
+ });
mockedThreadApi.getThreadMessages.mockResolvedValueOnce({ messages: [message], count: 1 });
await store.dispatch(loadThreadMessages('channel:telegram/alice/room-1'));
@@ -115,7 +123,13 @@ describe('threadSlice synchronous reducers', () => {
expect(
store.getState().thread.messagesByThreadId['channel:telegram/alice/room-1']?.[0]
?.extraMetadata?.channelActivity
- ).toEqual({ reactions: [{ actorId: 'alice', value: 'πŸ”₯' }], readReceipts: [] });
+ ).toEqual({
+ reactions: [
+ { actorId: 'bob', value: 'πŸŽ‰' },
+ { actorId: 'alice', value: 'πŸ”₯' },
+ ],
+ readReceipts: [{ actorId: 'carol', timestamp: 123 }],
+ });
expect(
store.getState().thread.messagesByThreadId['channel:telegram/alice/room-1']?.[0]?.id
).toBe('user:row-42');