fix(helper-plugin): BigInt mistake

This commit is contained in:
Jamie Howard 2023-01-20 08:44:18 +00:00
parent 98fdd17fcd
commit 688baffb9c
3 changed files with 3 additions and 8 deletions

View File

@ -56,7 +56,7 @@ const GenericInput = ({
description, description,
minimum, minimum,
maximum, maximum,
units: getFieldUnits({ type, name, minimum, maximum }), units: getFieldUnits({ type, minimum, maximum }),
}); });
const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);

View File

@ -1,12 +1,11 @@
/** /**
* @param {String} type * @param {String} type
* @param {String} name
* @param {Number} minimum * @param {Number} minimum
* @param {Number} maximum * @param {Number} maximum
* @returns {'' | 'characters' | 'character'} * @returns {'' | 'characters' | 'character'}
*/ */
const getFieldUnits = ({ type, name, minimum, maximum }) => { const getFieldUnits = ({ type, minimum, maximum }) => {
if (type === 'number' || name === 'BIGINT') { if (type === 'number') {
return ''; return '';
} }
const plural = Math.max(minimum || 0, maximum || 0) > 1; const plural = Math.max(minimum || 0, maximum || 0) > 1;

View File

@ -6,10 +6,6 @@ describe('Content Manager | Inputs | Utils', () => {
expect(getFieldUnits({ type: 'number' })).toEqual(''); expect(getFieldUnits({ type: 'number' })).toEqual('');
}); });
it('returns <empty string> for BIGINT types', () => {
expect(getFieldUnits({ name: 'BIGINT' })).toEqual('');
});
it('returns "character" when neither minimum or maximum is greater than 1', () => { it('returns "character" when neither minimum or maximum is greater than 1', () => {
expect(getFieldUnits({ type: 'text', minimum: 1, maximum: 1 })).toEqual('character'); expect(getFieldUnits({ type: 'text', minimum: 1, maximum: 1 })).toEqual('character');
}); });