Skip to content

Commit

Permalink
Update tests for download button display conditions, which were updat…
Browse files Browse the repository at this point in the history
…ed to correctly reflect device settings
  • Loading branch information
marcellamaki committed Oct 10, 2023
1 parent 31a08cc commit a2d6ab7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@
return this.content.admin_imported || this.isDownloadedByLearner(this.content);
},
allowRemoteDownload() {
console.log(this.canAddDownloads);
return (
this.isUserLoggedIn && this.isRemoteContent && !this.isDownloaded && this.canAddDownloads
);
Expand Down
7 changes: 7 additions & 0 deletions kolibri/plugins/learn/assets/test/views/topic-content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import useDownloadRequests, {
useDownloadRequestsMock,
} from '../../src/composables/useDownloadRequests';
import useChannels, { useChannelsMock } from '../../src/composables/useChannels';
import useCoreLearn, { useCoreLearnMock } from '../../src/composables/useCoreLearn';
/* eslint-enable import/named */

jest.mock('kolibri.urls');
jest.mock('kolibri.client');
jest.mock('kolibri.resources');
jest.mock('../../src/composables/useDownloadRequests');
jest.mock('../../src/composables/useChannels');
jest.mock('../../src/composables/useCoreLearn');
jest.mock('../../src/composables/useDevices');

const CONTENT_ID = 'content-id';
Expand Down Expand Up @@ -213,6 +215,11 @@ describe('TopicsContentPage', () => {
isDownloadingByLearner: () => true,
})
);
useCoreLearn.mockImplementation(() =>
useCoreLearnMock({
canAddDownloads: () => true,
})
);
wrapper = await makeAuthWrapperWithRemoteContent();
});

Expand Down

0 comments on commit a2d6ab7

Please sign in to comment.