Chatwoot/app/javascript/dashboard/store/modules/specs/auth/getters.spec.js
Sojan Jose 43147b3163
Chore: Fix presence for current user (#1001)
Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
2020-07-04 20:03:16 +05:30

28 lines
808 B
JavaScript

import { getters } from '../../auth';
import '../../../../routes';
jest.mock('../../../../routes', () => {});
describe('#getters', () => {
it('isLoggedIn', () => {
expect(getters.isLoggedIn({ currentUser: { id: null } })).toEqual(false);
expect(getters.isLoggedIn({ currentUser: { id: 1 } })).toEqual(true);
});
it('getCurrentUserID', () => {
expect(getters.getCurrentUserID({ currentUser: { id: 1 } })).toEqual(1);
});
it('getCurrentUser', () => {
expect(
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');
});
});