Skip to content

Commit

Permalink
Removes unnecessary kolibri store in tests (#11852)
Browse files Browse the repository at this point in the history
* Use responsive composable instead of mixin to fix errors from the mixin.

* fix:unnecessary-Kolibri-store-in-tests

* Update CardGrid.vue

* Update CardGrid.vue

* fix:unnecessary-Kolibri-store-in-tests

* Update utils.js
  • Loading branch information
nick2432 authored Feb 21, 2024
1 parent 9552455 commit f66f87c
Show file tree
Hide file tree
Showing 20 changed files with 8 additions and 47 deletions.
2 changes: 0 additions & 2 deletions kolibri/core/assets/test/download-button.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import DownloadButton from '../src/views/ContentRenderer/DownloadButton';

jest.mock('kolibri.urls');
Expand Down Expand Up @@ -27,7 +26,6 @@ describe('download-button Component', function() {
propsData: {
files: samplesFiles,
},
store,
});
expect(wrapper.vm.fileOptions.length).toEqual(samplesFiles.length);
});
Expand Down
5 changes: 0 additions & 5 deletions kolibri/core/assets/test/progress-bar.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import ProgressBar from '../src/views/ProgressBar';

function testProgressBar(wrapper, expected) {
Expand All @@ -14,7 +13,6 @@ describe('ProgressBar Component', () => {
propsData: {
progress: -0.0000001,
},
store,
});
// The negative still shows up...
testProgressBar(wrapper, { text: '-0%', width: '0%' });
Expand All @@ -25,7 +23,6 @@ describe('ProgressBar Component', () => {
propsData: {
progress: 0.1,
},
store,
});
testProgressBar(wrapper, { text: '10%', width: '10%' });
});
Expand All @@ -35,7 +32,6 @@ describe('ProgressBar Component', () => {
propsData: {
progress: 1.0,
},
store,
});
testProgressBar(wrapper, { text: '100%', width: '100%' });
});
Expand All @@ -45,7 +41,6 @@ describe('ProgressBar Component', () => {
propsData: {
progress: 1.0000001,
},
store,
});
testProgressBar(wrapper, { text: '100%', width: '100%' });
});
Expand Down
5 changes: 0 additions & 5 deletions kolibri/core/assets/test/progress-icon.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import UiIcon from 'kolibri-design-system/lib/keen/UiIcon';
import ProgressIcon from '../src/views/ProgressIcon';

Expand All @@ -19,7 +18,6 @@ describe('ProgressIcon Component', () => {
// Causes a validation error
progress: -1.0,
},
store,
});
await wrapper.vm.$nextTick();
const tooltip = wrapper.findComponent({ name: 'KTooltip' });
Expand All @@ -33,7 +31,6 @@ describe('ProgressIcon Component', () => {
propsData: {
progress: 0.1,
},
store,
});
await wrapper.vm.$nextTick();
testIcon(wrapper, 'In progress');
Expand All @@ -44,7 +41,6 @@ describe('ProgressIcon Component', () => {
propsData: {
progress: 1.0,
},
store,
});
await wrapper.vm.$nextTick();
testIcon(wrapper, 'Completed');
Expand All @@ -55,7 +51,6 @@ describe('ProgressIcon Component', () => {
propsData: {
progress: 2.0,
},
store,
});
await wrapper.vm.$nextTick();
testIcon(wrapper, 'Completed');
Expand Down
2 changes: 0 additions & 2 deletions kolibri/core/assets/test/views/KTooltip.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import KTooltipExample from './KTooltipExample';

const DEFAULT_PROPS = {
Expand All @@ -14,7 +13,6 @@ function makeWrapper(kTooltipProps = DEFAULT_PROPS, slot = 'Sample tooltip conte
slots: {
default: slot,
},
store,
});
}
describe('KTooltip component', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import AssignmentDeleteModal from '../../src/views/plan/assignments/AssignmentDeleteModal';

const defaultProps = {
Expand All @@ -21,7 +20,6 @@ describe('AssignmentDeleteModal', () => {
const submitListener = jest.fn();
const { els } = makeWrapper({
propsData: { ...defaultProps },
store,
listeners: {
submit: submitListener,
},
Expand All @@ -34,7 +32,6 @@ describe('AssignmentDeleteModal', () => {
const cancelListener = jest.fn();
const { els } = makeWrapper({
propsData: { ...defaultProps },
store,
listeners: {
cancel: cancelListener,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
//import store from 'kolibri.coreVue.vuex.store';
import makeStore from '../makeStore';
import AssignmentDetailsModal from '../../src/views/plan/assignments/AssignmentDetailsModal';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import ChannelTokenModal from '../../src/views/AvailableChannelsPage/ChannelTokenModal';

function makeWrapper(options = {}) {
return mount(ChannelTokenModal, { store, ...options, attrs: { disabled: false } });
return mount(ChannelTokenModal, { ...options, attrs: { disabled: false } });
}

function getElements(wrapper) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import ContentNodeRow from '../../src/views/SelectContentPage/ContentNodeRow';
import { makeNode } from '../utils/data';
import router from './testRouter';
Expand All @@ -25,7 +24,6 @@ const defaultProps = {
function makeWrapper(props = {}) {
return mount(ContentNodeRow, {
propsData: { ...defaultProps, ...props },
store,
...router,
});
}
Expand Down Expand Up @@ -73,7 +71,7 @@ describe('contentNodeRow component', () => {
});

it('topic links have the correct route', () => {
const wrapper = makeWrapper({ store });
const wrapper = makeWrapper();
const { goToTopicButton } = getElements(wrapper);
expect(goToTopicButton().props().to).toMatchObject({
name: 'SELECT_CONTENT',
Expand Down
2 changes: 0 additions & 2 deletions kolibri/plugins/epub_viewer/assets/tests/BottomBar.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import BottomBar from '../src/views/BottomBar';

function createWrapper({
Expand All @@ -15,7 +14,6 @@ function createWrapper({
sliderStep,
locationsAreReady,
},
store,
});
}

Expand Down
3 changes: 1 addition & 2 deletions kolibri/plugins/epub_viewer/assets/tests/NextButton.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import NextButton from '../src/views/NextButton';

function createWrapper() {
return mount(NextButton, { store });
return mount(NextButton);
}

describe('Next button', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import PreviousButton from '../src/views/PreviousButton';

function createWrapper() {
return mount(PreviousButton, { store });
return mount(PreviousButton);
}

describe('Previous button', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import SearchButton from '../src/views/SearchButton';

function createWrapper() {
return mount(SearchButton, { store });
return mount(SearchButton);
}

describe('Search button', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import SearchSideBar from '../src/views/SearchSideBar';

function createWrapper() {
Expand All @@ -9,7 +8,6 @@ function createWrapper() {
propsData: {
book: {},
},
store,
attachTo: node,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import SettingsButton from '../src/views/SettingsButton';

function createWrapper() {
return mount(SettingsButton, { store });
return mount(SettingsButton);
}

describe('Settings button', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import SettingsSideBar from '../src/views/SettingsSideBar';
import { THEMES } from '../src/views/EpubConstants';

Expand All @@ -8,7 +7,6 @@ function createWrapper({ theme = THEMES.BEIGE } = {}) {
propsData: {
theme,
},
store,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import TableOfContentsSection from '../src/views/TableOfContentsSection';

const section = {
Expand Down Expand Up @@ -35,7 +34,6 @@ function createWrapper({ section, depth, currentSection } = {}) {
depth,
currentSection,
},
store,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import TableOfContentsSideBar from '../src/views/TableOfContentsSideBar';

const toc = [
Expand Down Expand Up @@ -31,7 +30,6 @@ function createWrapper({ toc, currentSection } = {}) {
toc,
currentSection,
},
store,
});
}

Expand Down
3 changes: 1 addition & 2 deletions kolibri/plugins/epub_viewer/assets/tests/TocButton.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import TocButton from '../src/views/TocButton';

function createWrapper() {
return mount(TocButton, { store });
return mount(TocButton);
}

describe('Table of contents button', () => {
Expand Down
2 changes: 0 additions & 2 deletions kolibri/plugins/epub_viewer/assets/tests/TopBar.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import TopBar from '../src/views/TopBar';

function createWrapper({ title, isInFullscreen = false } = {}) {
Expand All @@ -10,7 +9,6 @@ function createWrapper({ title, isInFullscreen = false } = {}) {
title,
isInFullscreen,
},
store,
attachTo: node,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { mount } from '@vue/test-utils';
import store from 'kolibri.coreVue.vuex.store';
import PersonalDataConsentForm from '../../src/views/onboarding-forms/PersonalDataConsentForm';

function makeWrapper() {
const wrapper = mount(PersonalDataConsentForm, { store });
const wrapper = mount(PersonalDataConsentForm);
return { wrapper };
}

Expand Down

0 comments on commit f66f87c

Please sign in to comment.