Skip to content

Commit 522f49b

Browse files
committed
presence tests: Fill in other ClientPresences next to aggregateds
Every UserPresence is supposed to have an `aggregated` key, and soon we'll bring Flow into this file to help us make sure we include it. But UserPresence has another requirement, and I'm not sure if there's a nice way to get Flow to help with it: it's *also* supposed to have one or more other `ClientPresence`s that `aggregated` is aggregated across. So, in this separate commit before bringing in Flow, fill in a `ClientPresence` next to each `aggregated` that doesn't have one.
1 parent f27d020 commit 522f49b

File tree

1 file changed

+12
-28
lines changed

1 file changed

+12
-28
lines changed

src/presence/__tests__/presenceReducer-test.js

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ describe('presenceReducer', () => {
1515
test('when `presence` data is provided init state with it', () => {
1616
const presenceData = {
1717
18-
aggregated: {
19-
client: 'website',
20-
status: 'active',
21-
timestamp: 123,
22-
},
18+
aggregated: { client: 'website', status: 'active', timestamp: 123 },
19+
website: { client: 'website', status: 'active', timestamp: 123 },
2320
},
2421
};
2522
const prevState = deepFreeze({});
@@ -39,11 +36,8 @@ describe('presenceReducer', () => {
3936
test('when no `presence` data is given reset state', () => {
4037
const prevState = deepFreeze({
4138
42-
aggregated: {
43-
client: 'website',
44-
status: 'active',
45-
timestamp: 123,
46-
},
39+
aggregated: { client: 'website', status: 'active', timestamp: 123 },
40+
website: { client: 'website', status: 'active', timestamp: 123 },
4741
},
4842
});
4943
const action = deepFreeze({
@@ -62,10 +56,8 @@ describe('presenceReducer', () => {
6256
test('merges a single user in presence response', () => {
6357
const presence = {
6458
65-
aggregated: {
66-
status: 'active',
67-
timestamp: 123,
68-
},
59+
aggregated: { status: 'active', timestamp: 123 },
60+
website: { status: 'active', timestamp: 123 },
6961
},
7062
};
7163
const action = deepFreeze({
@@ -80,10 +72,8 @@ describe('presenceReducer', () => {
8072

8173
const expectedState = {
8274
83-
aggregated: {
84-
status: 'active',
85-
timestamp: 123,
86-
},
75+
aggregated: { status: 'active', timestamp: 123 },
76+
website: { status: 'active', timestamp: 123 },
8777
},
8878
};
8979

@@ -100,11 +90,8 @@ describe('presenceReducer', () => {
10090

10191
const presence = {
10292
103-
aggregated: {
104-
client: 'website',
105-
status: 'active',
106-
timestamp: 123,
107-
},
93+
aggregated: { client: 'website', status: 'active', timestamp: 123 },
94+
website: { client: 'website', status: 'active', timestamp: 123 },
10895
},
10996
11097
website: {
@@ -122,11 +109,8 @@ describe('presenceReducer', () => {
122109

123110
const expectedState = {
124111
125-
aggregated: {
126-
client: 'website',
127-
status: 'active',
128-
timestamp: 123,
129-
},
112+
aggregated: { client: 'website', status: 'active', timestamp: 123 },
113+
website: { client: 'website', status: 'active', timestamp: 123 },
130114
},
131115
132116
website: {

0 commit comments

Comments
 (0)