Skip to content

Commit

Permalink
feat: Added support to redirect to DSC if required. (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
HammadAhmadWaqas authored Jul 25, 2022
1 parent 36062ff commit 3e76f7a
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 36 deletions.
213 changes: 177 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
"@reduxjs/toolkit": "1.8.1",
"classnames": "2.3.1",
"core-js": "3.22.2",
"history": "^5.3.0",
"js-cookie": "3.0.1",
"lodash.camelcase": "4.3.0",
"prop-types": "15.8.1",
"query-string": "^7.1.1",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-helmet": "6.1.0",
Expand Down
8 changes: 8 additions & 0 deletions src/courseware/CoursewareContainer.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ describe('CoursewareContainer', () => {
has_access: false,
error_code: errorCode,
additional_context_user_message: 'uhoh oh no', // only used by audit_expired
developer_message: 'data_sharing_consent_url', // only used by data_sharing_access_required
},
});

Expand All @@ -475,6 +476,13 @@ describe('CoursewareContainer', () => {
expect(global.location.href).toEqual(`http://localhost/redirect/survey/${courseMetadata.id}`);
});

it('should go to consent page for a data_sharing_access_required error code', async () => {
setUpWithDeniedStatus('data_sharing_access_required');
await loadContainer();

expect(global.location.href).toEqual('http://localhost/redirect/consent?consentPath=data_sharing_consent_url');
});

it('should go to course home for an authentication_required error code', async () => {
const { courseMetadata } = setUpWithDeniedStatus('authentication_required');
await loadContainer();
Expand Down
Loading

0 comments on commit 3e76f7a

Please sign in to comment.