2021-02-04 07:49:59 +00:00
|
|
|
import { getters } from '../../teams/getters';
|
|
|
|
import teamsList from './fixtures';
|
|
|
|
|
|
|
|
describe('#getters', () => {
|
|
|
|
it('getTeams', () => {
|
|
|
|
const state = {
|
|
|
|
records: teamsList,
|
|
|
|
};
|
2021-02-13 09:28:05 +00:00
|
|
|
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]]);
|
2021-02-04 07:49:59 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('getTeam', () => {
|
|
|
|
const state = {
|
|
|
|
records: teamsList,
|
|
|
|
};
|
|
|
|
expect(getters.getTeam(state)(1)).toEqual({
|
|
|
|
id: 1,
|
|
|
|
account_id: 1,
|
|
|
|
name: 'Test',
|
|
|
|
description: 'Some team',
|
2021-02-13 09:28:05 +00:00
|
|
|
is_member: true,
|
2021-02-04 07:49:59 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
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,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|