Skip to content

Commit

Permalink
Removing unused diffs and fix librarypage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Aug 23, 2024
1 parent 981bac5 commit 4953fe7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions kolibri/plugins/learn/assets/src/views/LibraryPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
import appCapabilities, { checkCapability } from 'kolibri.utils.appCapabilities';
import LearningActivityChip from 'kolibri-common/components/ResourceDisplayAndSearch/LearningActivityChip.vue';
import { searchKeys } from 'kolibri-common/composables/useBaseSearch';
import useSearch from '../../composables/useSearch';
import SidePanelModal from '../SidePanelModal';
import SearchFiltersPanel from '../SearchFiltersPanel';
import { KolibriStudioId, PageNames } from '../../constants';
Expand All @@ -187,6 +186,7 @@
setCurrentDevice,
StudioNotAllowedError,
} from '../../composables/useDevices';
import useSearch from '../../composables/useSearch';
import useLearnerResources from '../../composables/useLearnerResources';
import BrowseResourceMetadata from '../BrowseResourceMetadata';
import commonLearnStrings from '../commonLearnStrings';
Expand Down Expand Up @@ -235,8 +235,6 @@
isLearnerOnlyImport,
} = useUser();
const { allowDownloadOnMeteredConnection } = useDeviceSettings();
const { baseurl, deviceName } = currentDeviceData();
const {
searchTerms,
displayingSearchResults,
Expand All @@ -263,6 +261,7 @@
const { canAddDownloads, canDownloadExternally } = useCoreLearn();
const { currentCardViewStyle } = useCardViewStyle();
const { back } = useContentLink();
const { baseurl, deviceName } = currentDeviceData();
const { fetchChannels } = useChannels();
onMounted(() => {
Expand Down
3 changes: 1 addition & 2 deletions kolibri/plugins/learn/assets/src/views/TopicsPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@
const store = currentInstance.$store;
const router = currentInstance.$router;
const topic = ref(null);
const { fetchContentNodeProgress, fetchContentNodeTreeProgress } = useContentNodeProgress();
const {
searchTerms,
displayingSearchResults,
Expand All @@ -381,6 +379,7 @@
const { back, genContentLinkKeepCurrentBackLink } = useContentLink();
const { windowBreakpoint, windowIsLarge, windowIsSmall } = useKResponsiveWindow();
const { channelsMap, fetchChannels } = useChannels();
const { fetchContentNodeProgress, fetchContentNodeTreeProgress } = useContentNodeProgress();
const { isUserLoggedIn, isCoach, isAdmin, isSuperuser } = useUser();
const { fetchUserDownloadRequests } = useDownloadRequests(store);
Expand Down
4 changes: 2 additions & 2 deletions kolibri/plugins/learn/assets/test/views/library-page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ const CHANNEL = {
jest.mock('../../src/composables/useChannels');
jest.mock('../../src/composables/useCardLayoutSpan');
jest.mock('../../src/composables/useDevices');
jest.mock('kolibri-common/composables/useBaseSearch');
jest.mock('../../src/composables/useLearnerResources');
jest.mock('../../src/composables/useLearningActivities');
jest.mock('../../src/composables/useContentLink');
jest.mock('../../src/composables/usePinnedDevices');
jest.mock('kolibri-common/composables/useBaseSearch');
jest.mock('kolibri.coreVue.composables.useUser');
jest.mock('kolibri-design-system/lib/composables/useKResponsiveWindow');
jest.mock('kolibri.resources');
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('LibraryPage', () => {
const wrapper = await makeWrapper();
expect(wrapper.find('[data-test="filter-button"').element).toBeFalsy();
});
it('is hidden when the page is large and channels are available', async () => {
it.only('is hidden when the page is large and channels are available', async () => {
useKResponsiveWindow.mockImplementation(() => ({
windowIsLarge: true,
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ jest.mock('kolibri.client');
jest.mock('kolibri.resources');
jest.mock('kolibri.urls');
jest.mock('kolibri.coreVue.composables.useUser');
jest.mock('../../src/composables/useContentLink');
jest.mock('kolibri-common/composables/useBaseSearch');
jest.mock('../../src/composables/useContentLink');
jest.mock('../../src/composables/useChannels');
// Needed to test anything using mount() where children use this composable
jest.mock('../../src/composables/useLearningActivities');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function useBaseSearchMock(overrides = {}) {
};
}

export default jest.fn(() => useBaseSearch());
export default jest.fn(() => useBaseSearchMock());

export const injectBaseSearch = jest.fn(() => ({
availableLearningActivities: [],
Expand Down
4 changes: 2 additions & 2 deletions packages/kolibri-common/composables/useBaseSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default function useBaseSearch({
}

function search() {
const currentBaseUrl = baseurl && get(baseurl);
const currentBaseUrl = get(baseurl);
const getParams = {
include_coach_content:
store.getters.isAdmin || store.getters.isCoach || store.getters.isSuperuser,
Expand Down Expand Up @@ -367,7 +367,7 @@ export default function useBaseSearch({

function ensureGlobalLabels() {
set(globalLabelsLoading, true);
const currentBaseUrl = baseurl && get(baseurl);
const currentBaseUrl = get(baseurl);
ContentNodeResource.fetchCollection({
getParams: { max_results: 1, baseurl: currentBaseUrl },
})
Expand Down

0 comments on commit 4953fe7

Please sign in to comment.