Skip to content

Commit f9533cb

Browse files
committed
chore(davinci-client): address remaining pr feedback
- Drop accidental .opensource/forgerock-javascript-sdk gitlink - Reorder validate() in client.store so success branches follow all error checks - Rename PASSWORD-with-policy reducer test for clarity
1 parent 7012138 commit f9533cb

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/davinci-client/src/lib/client.store.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,8 @@ export async function davinci<ActionType extends ActionTypes = ActionTypes>({
399399
);
400400
}
401401

402-
if (collectorToUpdate.type === 'ValidatedPasswordCollector') {
403-
return returnPasswordPolicyValidator(collectorToUpdate);
404-
}
405-
406402
if (
403+
collectorToUpdate.type !== 'ValidatedPasswordCollector' &&
407404
collectorToUpdate.category !== 'ValidatedSingleValueCollector' &&
408405
collectorToUpdate.category !== 'ObjectValueCollector' &&
409406
collectorToUpdate.category !== 'MultiValueCollector' &&
@@ -416,14 +413,21 @@ export async function davinci<ActionType extends ActionTypes = ActionTypes>({
416413
);
417414
}
418415

419-
if (!('validation' in collectorToUpdate.input)) {
416+
if (
417+
collectorToUpdate.type !== 'ValidatedPasswordCollector' &&
418+
!('validation' in collectorToUpdate.input)
419+
) {
420420
return handleUpdateValidateError(
421421
'Collector has no validation rules',
422422
'state_error',
423423
log.error,
424424
);
425425
}
426426

427+
if (collectorToUpdate.type === 'ValidatedPasswordCollector') {
428+
return returnPasswordPolicyValidator(collectorToUpdate);
429+
}
430+
427431
return returnValidator(collectorToUpdate);
428432
},
429433

packages/davinci-client/src/lib/node.reducer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ describe('PASSWORD_VERIFY with password policy', () => {
13131313
expect((result[0] as ValidatedPasswordCollector).output.passwordPolicy).toEqual({});
13141314
});
13151315

1316-
it('should produce PasswordCollector when a PASSWORD field carries a policy (policy ignored)', () => {
1316+
it('should ignore passwordPolicy on a PASSWORD field and produce a PasswordCollector', () => {
13171317
const action = {
13181318
type: 'node/next',
13191319
payload: {

0 commit comments

Comments
 (0)