Skip to content

Commit

Permalink
fix: address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jjarvisp committed Feb 17, 2025
1 parent 2706ceb commit b13c415
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ describe('SelectMfaType', () => {
const { queryByText } = render(<SelectMfaType {...props} isPending />);

expect(queryByText(getConfirmingText())).toBeDefined();
expect(queryByText(getConfirmText())).toBe(null);
expect(queryByText(getConfirmText())).toBeNull();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ describe('SetupEmail', () => {
const { queryByText } = render(<SetupEmail {...props} isPending />);

expect(queryByText(getConfirmingText())).toBeDefined();
expect(queryByText(getConfirmText())).toBe(null);
expect(queryByText(getConfirmText())).toBeNull();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const DefaultFormFields = ({
fieldLabelStyle,
isPending = false,
validationErrors,
fields,
fields = [],
style,
}: DefaultFormFieldsProps): React.JSX.Element => {
const formFields = (fields ?? []).map((field) => {
const formFields = fields.map((field) => {
const errors = validationErrors
? getErrors(validationErrors?.[field.name])
: [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ describe('getSanitizedFields', () => {
'Each field must have a name; field has been ignored.'
);

expect(output).toHaveLength(1);
expect(output).toStrictEqual([validField]);
});

Expand All @@ -214,10 +213,9 @@ describe('getSanitizedFields', () => {

expect(warnSpy).toHaveBeenCalledTimes(1);
expect(warnSpy).toHaveBeenCalledWith(
'Each field name must be unique; field with duplicate name of email has been ignored.'
'Each field name must be unique; field with duplicate name of "email" has been ignored.'
);

expect(output).toHaveLength(1);
expect(output).toStrictEqual([validField]);
});

Expand All @@ -237,10 +235,9 @@ describe('getSanitizedFields', () => {

expect(warnSpy).toHaveBeenCalledTimes(1);
expect(warnSpy).toHaveBeenCalledWith(
'Each radio field must have at least one option available for selection; field without radioOptions mfa_type has been ignored.'
'Each radio field must have at least one option available for selection; field of name "mfa_type" without radioOptions has been ignored.'
);

expect(output).toHaveLength(1);
expect(output).toStrictEqual([validField]);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ export const getSanitizedFields = (fields: TypedField[]): TypedField[] => {

if (names[name]) {
logger.warn(
`Each field name must be unique; field with duplicate name of ${name} has been ignored.`
`Each field name must be unique; field with duplicate name of "${name}" has been ignored.`
);
return false;
}

if (isRadioFieldOptions(field) && !field.radioOptions?.length) {
logger.warn(
`Each radio field must have at least one option available for selection; field without radioOptions ${name} has been ignored.`
`Each radio field must have at least one option available for selection; field of name "${name}" without radioOptions has been ignored.`
);
return false;
}
Expand Down

0 comments on commit b13c415

Please sign in to comment.