Skip to content

Commit

Permalink
Add unit test for openGroupChannelToUserIds (mattermost#4199)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Lai authored and saturninoabril committed Nov 14, 2019
1 parent f9567e3 commit 2115f1d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions actions/channel_actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jest.mock('mattermost-redux/actions/channels', () => ({
};
},
addChannelMember: (...args) => ({type: 'MOCK_ADD_CHANNEL_MEMBER', args}),
createGroupChannel: (...args) => ({type: 'MOCK_CREATE_GROUP_CHANNEL', args}),
}));

jest.mock('actions/user_actions.jsx', () => ({
Expand Down Expand Up @@ -158,4 +159,20 @@ describe('Actions.Channel', () => {
await testStore.dispatch(Actions.addUsersToChannel(fakeData.channel, fakeData.userIds));
expect(testStore.getActions()).toEqual(expectedActions);
});

test('openGroupChannelToUserIds', async () => {
const testStore = await mockStore(initialState);

const expectedActions = [{
type: 'MOCK_CREATE_GROUP_CHANNEL',
args: [['testuserid1', 'testuserid2']]
}];

const fakeData = {
userIds: ['testuserid1', 'testuserid2']
};

await testStore.dispatch(Actions.openGroupChannelToUserIds(fakeData.userIds));
expect(testStore.getActions()).toEqual(expectedActions);
});
});

0 comments on commit 2115f1d

Please sign in to comment.