diff --git a/src/library/zoid/message/validation.js b/src/library/zoid/message/validation.js index a72bde4d97..75da6fc2b5 100644 --- a/src/library/zoid/message/validation.js +++ b/src/library/zoid/message/validation.js @@ -74,9 +74,8 @@ export default { const isInvalid = merchantId.split(',').some(id => id.length !== 13 && id.length !== 10); if (isInvalid) { logInvalid('merchantId', 'Ensure the correct Merchant ID has been entered.'); - } else { - return merchantId; } + return merchantId; } } return undefined; diff --git a/tests/unit/spec/src/zoid/message/validation.test.js b/tests/unit/spec/src/zoid/message/validation.test.js index 557272c09b..3c9a3542a5 100644 --- a/tests/unit/spec/src/zoid/message/validation.test.js +++ b/tests/unit/spec/src/zoid/message/validation.test.js @@ -62,7 +62,7 @@ describe('validate', () => { merchantId = validate.merchantId({ props: { merchantId: 'DEV00000000,DEV00000001NI' } }); - expect(merchantId).toBeUndefined(); + expect(merchantId).toEqual(merchantId); expect(console.warn).toHaveBeenCalledTimes(1); expect(console.warn).toHaveBeenLastCalledWith( expect.stringContaining('invalid_option_value'), @@ -71,7 +71,7 @@ describe('validate', () => { merchantId = validate.merchantId({ props: { merchantId: 'client-id:test_client_id' } }); - expect(merchantId).toBeUndefined(); + expect(merchantId).toEqual(merchantId); expect(console.warn).toHaveBeenCalledTimes(1); expect(console.warn).toHaveBeenLastCalledWith( expect.stringContaining('invalid_option_value'),