@@ -150,52 +150,25 @@ describe('reducer', () => {
150
150
initialState ,
151
151
) ;
152
152
} ) ;
153
+ } ) ;
153
154
154
- describe ( 'redundantly after EVENT_MUTED_TOPICS' , ( ) => {
155
- // The server may send both muted_topics events and user_topic events,
156
- // because we don't set event_types in our /register request:
157
- // https://github.com/zulip/zulip/pull/21251#issuecomment-1133466148
158
- // So we may get one of these after a muted_topics event has already
159
- // set the new state.
160
- //
161
- // (Or we might get user_topic first and then muted_topics, but that
162
- // doesn't require any testing of its own -- when handling the
163
- // muted_topics event it doesn't matter what the previous state was.)
164
-
165
- test ( 'add' , ( ) => {
166
- check (
167
- makeMuteState ( [ [ eg . stream , 'topic' ] ] ) ,
168
- makeUserTopic ( eg . stream , 'topic' , UserTopicVisibilityPolicy . Muted ) ,
169
- makeMuteState ( [ [ eg . stream , 'topic' ] ] ) ,
170
- ) ;
171
- } ) ;
172
-
173
- test ( 'remove, leaving others in stream' , ( ) => {
174
- check (
175
- makeMuteState ( [ [ eg . stream , 'topic' ] ] ) ,
176
- makeUserTopic ( eg . stream , 'other topic' , UserTopicVisibilityPolicy . None ) ,
177
- makeMuteState ( [ [ eg . stream , 'topic' ] ] ) ,
178
- ) ;
179
- } ) ;
155
+ describe ( 'EVENT_MUTED_TOPICS (legacy)' , ( ) => {
156
+ const action = deepFreeze ( {
157
+ type : EVENT_MUTED_TOPICS ,
158
+ id : - 1 ,
159
+ muted_topics : [ [ eg . stream . name , 'topic' ] ] ,
160
+ } ) ;
180
161
181
- test ( 'remove, as last in stream' , ( ) => {
182
- check (
183
- makeMuteState ( [ ] ) ,
184
- makeUserTopic ( eg . stream , 'topic' , UserTopicVisibilityPolicy . None ) ,
185
- makeMuteState ( [ ] ) ,
186
- ) ;
187
- } ) ;
162
+ test ( 'ignored when on a current server' , ( ) => {
163
+ expect ( reducer ( initialState , action , eg . plusReduxState ) ) . toEqual ( initialState ) ;
188
164
} ) ;
189
- } ) ;
190
165
191
- describe ( 'EVENT_MUTED_TOPICS (legacy)' , ( ) => {
192
- test ( 'appends and test a new muted topic' , ( ) => {
193
- const action = deepFreeze ( {
194
- type : EVENT_MUTED_TOPICS ,
195
- id : - 1 ,
196
- muted_topics : [ [ eg . stream . name , 'topic' ] ] ,
166
+ test ( 'sets the state, when on an old server lacking user_topic' , ( ) => {
167
+ const globalState = eg . reduxStatePlus ( {
168
+ // TODO(server-6.0): We'll drop this muted_topics event type entirely.
169
+ accounts : [ { ...eg . plusReduxState . accounts [ 0 ] , zulipFeatureLevel : 133 } ] ,
197
170
} ) ;
198
- expect ( reducer ( initialState , action , eg . plusReduxState ) ) . toEqual (
171
+ expect ( reducer ( initialState , action , globalState ) ) . toEqual (
199
172
makeMuteState ( [ [ eg . stream , 'topic' ] ] ) ,
200
173
) ;
201
174
} ) ;
0 commit comments