diff --git a/lib/reducers/thread-activity-reducer.test.js b/lib/reducers/thread-activity-reducer.test.js --- a/lib/reducers/thread-activity-reducer.test.js +++ b/lib/reducers/thread-activity-reducer.test.js @@ -39,6 +39,24 @@ expect(result).toEqual(expectedState); }); + test('should create new thread activity entry with only lastNavigatedTo field', () => { + const initialState = {}; + const action = { + type: updateThreadLastNavigatedActionType, + payload: { + threadID: 'thread1', + time: 1639522317443, + }, + }; + const expectedState = { + thread1: { + lastNavigatedTo: 1639522317443, + }, + }; + const result = reduceThreadActivity(initialState, action); + expect(result).toEqual(expectedState); + }); + test('returns the initial state if the action type is not recognized', () => { const initialState = { thread1: { diff --git a/lib/types/thread-activity-types.js b/lib/types/thread-activity-types.js --- a/lib/types/thread-activity-types.js +++ b/lib/types/thread-activity-types.js @@ -5,7 +5,7 @@ export type ThreadActivityStoreEntry = { +lastNavigatedTo: number, // millisecond timestamp - +lastPruned: number, // millisecond timestamp + +lastPruned?: number, // millisecond timestamp }; export type ThreadActivityStore = { +[threadID: string]: ThreadActivityStoreEntry,