Chatwoot/app/javascript/dashboard/store/modules/specs/teams/getters.spec.js
Nithin David Thomas eaafc45f45
feat: Show teams on sidebar (#1754)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
Co-authored-by: Sojan <sojan@pepalo.com>
2021-02-13 14:58:05 +05:30

52 lines
1.1 KiB
JavaScript

import { getters } from '../../teams/getters';
import teamsList from './fixtures';
describe('#getters', () => {
it('getTeams', () => {
const state = {
records: teamsList,
};
expect(getters.getTeams(state)).toEqual([teamsList[1], teamsList[2]]);
});
it('getMyTeams', () => {
const state = {
records: teamsList,
};
expect(
getters.getMyTeams(state, {
getTeams: [teamsList[1], teamsList[2]],
})
).toEqual([teamsList[1]]);
});
it('getTeam', () => {
const state = {
records: teamsList,
};
expect(getters.getTeam(state)(1)).toEqual({
id: 1,
account_id: 1,
name: 'Test',
description: 'Some team',
is_member: true,
});
});
it('getUIFlags', () => {
const state = {
uiFlags: {
isFetching: false,
isCreating: false,
isUpdating: false,
isDeleting: false,
},
};
expect(getters.getUIFlags(state)).toEqual({
isFetching: false,
isCreating: false,
isUpdating: false,
isDeleting: false,
});
});
});