fix: Progressive Profiling can't convert undefined to object (#737)

This commit is contained in:
Shahbaz Shabbir
2023-01-23 13:06:04 +05:00
committed by GitHub
parent 6f2ce69b77
commit 9f50bbda79
2 changed files with 6 additions and 2 deletions

View File

@@ -471,7 +471,7 @@ const RegistrationPage = (props) => {
finishAuthUrl={finishAuthUrl}
optionalFields={optionalFields}
redirectToProgressiveProfilingPage={
getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).length !== 0
getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).includes('fields')
}
/>
<div className="mw-xs mt-3">

View File

@@ -739,6 +739,7 @@ describe('RegistrationPage', () => {
});
it('should redirect to progressive profiling page if optional fields are configured', () => {
getLocale.mockImplementation(() => ('en-us'));
mergeConfig({
ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: true,
});
@@ -753,7 +754,10 @@ describe('RegistrationPage', () => {
},
commonComponents: {
optionalFields: {
country: { name: 'country', error_message: false },
extended_profile: {},
fields: {
level_of_education: { name: 'level_of_education', error_message: false },
},
},
},
});