Skip to content

Commit 2f20dfe

Browse files
committed
caughtUp tests: Make some test data a bit more interesting
This way, we can test that the reducer doesn't go mess something up at a different key.
1 parent 5ad56cd commit 2f20dfe

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/caughtup/__tests__/caughtUpReducer-test.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
SEARCH_NARROW,
1212
streamNarrow,
1313
topicNarrow,
14+
pm1to1NarrowFromUser,
1415
} from '../../utils/narrow';
1516
import { objectFromEntries } from '../../jsBackport';
1617

@@ -59,23 +60,24 @@ describe('caughtUpReducer', () => {
5960
// MESSAGE_FETCH_START applies the identity function to the
6061
// state (i.e., it doesn't do anything to it). Reversing that
6162
// effect is also done with the identity function.
62-
const initialState = deepFreeze({
63-
[HOME_NARROW_STR]: {
64-
older: true,
65-
newer: true,
66-
},
67-
});
63+
64+
const narrow1 = pm1to1NarrowFromUser(eg.otherUser);
65+
const narrow2 = pm1to1NarrowFromUser(eg.thirdUser);
66+
67+
// Include some other narrow to test that the reducer doesn't go mess
68+
// something up there.
69+
const initialState = deepFreeze({ [keyFromNarrow(narrow1)]: { older: true, newer: true } });
6870

6971
const messageFetchStartAction = deepFreeze({
7072
...eg.action.message_fetch_start,
71-
narrow: HOME_NARROW,
73+
narrow: narrow2,
7274
});
7375

7476
const state1 = caughtUpReducer(initialState, messageFetchStartAction);
7577

7678
const messageFetchErrorAction = deepFreeze({
7779
type: MESSAGE_FETCH_ERROR,
78-
narrow: HOME_NARROW,
80+
narrow: narrow2,
7981
error: new Error(),
8082
});
8183

0 commit comments

Comments
 (0)