Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Nov 1, 2023
1 parent 0e05f90 commit 880f23e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { shallowMount, mount } from '@vue/test-utils';
import Vuex from 'vuex';
import { useDevicesWithFacility } from 'kolibri.coreVue.componentSets.sync';
import { LearningActivities } from 'kolibri.coreVue.vuex.constants';
import LearningActivityBar from '../../src/views/LearningActivityBar';

jest.mock('kolibri.coreVue.componentSets.sync');
function makeWrapper({ propsData } = {}) {
const store = new Vuex.Store({
state: { core: { loading: false } },
mutations: {
SET_SHOW_COMPLETE_CONTENT_MODAL: jest.fn(),
},
});
// stubbing out KCircularLoader, as using the actual component led to errors related to
// Vue Composition API - stub may not be needed once we upgrade to Vue 2.7
return mount(LearningActivityBar, { propsData, stubs: ['KCircularLoader'] });
return mount(LearningActivityBar, {
propsData,
stubs: ['KCircularLoader'],
data: () => ({ windowBreakpoint: 6 }),
store,
});
}

describe('LearningActivityBar', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ describe('when there are nodes with progress that can be resumed', () => {

it('displays grid / list toggle buttons when on medium or larger screens', () => {
const wrapper = shallowMount(ResumableContentGrid, {
computed: { windowIsMedium: () => true },
data: () => ({ windowIsSmall: false }),
});
expect(wrapper.find('[data-test="toggle-view-buttons"]').element).toBeTruthy();
});

it('does not show the grid / list toggle buttons when on extra small screens', async () => {
const wrapper = shallowMount(ResumableContentGrid, {
computed: { windowIsSmall: () => true },
data: () => ({ windowIsSmall: true }),
});
expect(wrapper.find('[data-test="toggle-view-buttons"]').element).toBeFalsy();
});
Expand Down

0 comments on commit 880f23e

Please sign in to comment.