Skip to content

Commit

Permalink
actionTypes: Make subscriptions[] exact on `EventSubscriptionRemove…
Browse files Browse the repository at this point in the history
…Action`.

The doc, at https://zulip.com/api/get-events, suggests that this
type already includes all fields that will be present. So, make it
exact.

An instance of zulip#3452.
  • Loading branch information
chrisbobbe authored and gnprice committed Mar 12, 2021
1 parent 1680622 commit 2f5fe9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ type EventSubscriptionRemoveAction = {|
...ServerEvent,
type: typeof EVENT_SUBSCRIPTION,
op: 'remove',
subscriptions: Array<{
subscriptions: Array<{|
name: string,
stream_id: number,
}>,
|}>,
|};

type EventSubscriptionUpdateAction = {|
Expand Down
10 changes: 8 additions & 2 deletions src/subscriptions/__tests__/subscriptionsReducer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ describe('subscriptionsReducer', () => {
type: EVENT_SUBSCRIPTION,
op: 'remove',
id: 1,
subscriptions: [sub1, sub2],
subscriptions: [
{ name: sub1.name, stream_id: sub1.stream_id },
{ name: sub2.name, stream_id: sub2.stream_id },
],
});

const expectedState = [sub3];
Expand All @@ -114,7 +117,10 @@ describe('subscriptionsReducer', () => {
type: EVENT_SUBSCRIPTION,
op: 'remove',
id: 1,
subscriptions: [sub1, sub2],
subscriptions: [
{ name: sub1.name, stream_id: sub1.stream_id },
{ name: sub2.name, stream_id: sub2.stream_id },
],
});

const expectedState = [];
Expand Down

0 comments on commit 2f5fe9c

Please sign in to comment.