Skip to content

Commit

Permalink
[TIP] Code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeOberti committed Sep 19, 2022
1 parent eb5538a commit 7d81350
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ describe('field_value', () => {
expect(result).toEqual(false);
});

it('should return false for empty string value', () => {
const mockField = 'abc';
const mockValue = '';

const result = fieldAndValueValid(mockField, mockValue);
expect(result).toEqual(false);
});

it(`should return false for ${EMPTY_VALUE} value`, () => {
const mockField = 'abc';
const mockValue = EMPTY_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ export const getIndicatorFieldAndValue = (
* @returns true if correct, false if not
*/
export const fieldAndValueValid = (field: string | null, value: string | null): boolean =>
value != null && value !== '' && value !== EMPTY_VALUE && field != null && field !== '';
!!value && value !== EMPTY_VALUE && !!field;

0 comments on commit 7d81350

Please sign in to comment.