From 1ee501f8b98bbd9b1ce938c8a94964255370160f Mon Sep 17 00:00:00 2001 From: Zainab Amir Date: Tue, 19 Jul 2022 23:01:08 -0700 Subject: [PATCH] feat: add query params to the payload (#602) --- src/register/RegistrationPage.jsx | 3 +++ src/register/tests/RegistrationPage.test.jsx | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index ccdf193d..f9a46d9f 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -242,6 +242,9 @@ class RegistrationPage extends React.Component { payload = snakeCaseObject(payload); payload.totalRegistrationTime = totalRegistrationTime; + + // add query params to the payload + payload = { ...payload, ...this.queryParams }; this.setState({ totalRegistrationTime, }, () => { diff --git a/src/register/tests/RegistrationPage.test.jsx b/src/register/tests/RegistrationPage.test.jsx index 1603b714..75fe8de9 100644 --- a/src/register/tests/RegistrationPage.test.jsx +++ b/src/register/tests/RegistrationPage.test.jsx @@ -85,6 +85,7 @@ describe('RegistrationPage', () => { handleInstitutionLogin: jest.fn(), institutionLogin: false, }; + window.location = { search: '' }; }); afterEach(() => { @@ -128,6 +129,9 @@ describe('RegistrationPage', () => { it('should submit form for valid input', () => { jest.spyOn(global.Date, 'now').mockImplementation(() => 0); + delete window.location; + window.location = { href: getConfig().BASE_URL, search: '?next=/course/demo-course-url' }; + const payload = { name: 'John Doe', username: 'john_doe', @@ -137,6 +141,7 @@ describe('RegistrationPage', () => { honor_code: true, totalRegistrationTime: 0, is_authn_mfe: true, + next: '/course/demo-course-url', }; store.dispatch = jest.fn(store.dispatch);