refactor(store): schools

Remove schools useless getter
pull/12/head
sundowndev 2019-12-07 18:07:25 +01:00
parent b4be27bb40
commit 604ab20565
3 changed files with 2 additions and 19 deletions

View File

@ -31,7 +31,7 @@ export default Vue.extend({
'checkAnswer',
'isLastQuestion',
]),
...mapGetters('schools', ['schools']),
...mapState('schools', ['schools']),
},
methods: {
answer(answer: number): void {

View File

@ -13,11 +13,7 @@ const schools: Module<IStoreSchools, any> = {
state: {
schools: [],
},
getters: {
schools(state): ISchool[] {
return state.schools;
},
},
getters: {},
mutations: {
setSchools(state, payload): ISchool[] {
return (state.schools = payload);

View File

@ -16,19 +16,6 @@ describe('Store - Questions', () => {
};
});
describe('Getters', () => {
describe('#schools', () => {
it('should get schools', () => {
state.schools = [{ id: '1', name: 'test' }, { id: '2', name: 'test2' }];
const data = getters.schools(state, null, null, null);
expect(data).toStrictEqual(state.schools);
expect(data.length).toBe(2);
});
});
});
describe('Mutations', () => {
describe('#setSchools', () => {
it('should set schools state', () => {