parent
b4be27bb40
commit
604ab20565
|
@ -31,7 +31,7 @@ export default Vue.extend({
|
|||
'checkAnswer',
|
||||
'isLastQuestion',
|
||||
]),
|
||||
...mapGetters('schools', ['schools']),
|
||||
...mapState('schools', ['schools']),
|
||||
},
|
||||
methods: {
|
||||
answer(answer: number): void {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in New Issue