Chore: Fix presence for current user (#1001)
Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
@@ -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([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,4 +17,12 @@ describe('#getters', () => {
|
||||
getters.getCurrentUser({ currentUser: { id: 1, name: 'Pranav' } })
|
||||
).toEqual({ id: 1, name: 'Pranav' });
|
||||
});
|
||||
|
||||
it('get', () => {
|
||||
expect(
|
||||
getters.getCurrentUserAvailabilityStatus({
|
||||
currentUser: { id: 1, name: 'Pranav', availability_status: 'busy' },
|
||||
})
|
||||
).toEqual('busy');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user