Chore: Fix presence for current user (#1001)

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2020-07-04 20:03:16 +05:30
committed by GitHub
parent 4612494923
commit 43147b3163
11 changed files with 78 additions and 20 deletions

View File

@@ -67,4 +67,30 @@ describe('#actions', () => {
expect(dispatch).toHaveBeenCalledTimes(0);
});
});
describe('#setCurrentUserAvailabilityStatus', () => {
it('sends correct mutations if user id is available', async () => {
actions.setCurrentUserAvailabilityStatus(
{
commit,
state: { currentUser: { id: 1 } },
},
{ 1: 'online' }
);
expect(commit.mock.calls).toEqual([
[types.default.SET_CURRENT_USER_AVAILABILITY, 'online'],
]);
});
it('does not send correct mutations if user id is not available', async () => {
actions.setCurrentUserAvailabilityStatus(
{
commit,
state: { currentUser: { id: 1 } },
},
{}
);
expect(commit.mock.calls).toEqual([]);
});
});
});