-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed logic in "42" tests #2203
base: master
Are you sure you want to change the base?
Conversation
The logic in the "42" tests was backwards. It was checking that the number didn't equal 42, when it should check the number does equal 42.
@@ -779,7 +779,7 @@ For instance this will work: | |||
let schema = number().test( | |||
'is-42', | |||
"this isn't the number i want", | |||
(value) => value != 42, | |||
(value) => value === 42, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(value) => value === 42, | |
(value) => value == null || value === 42, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying you want the test to pass if the value is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its undefined or null. that is handled by required
, defined
etc
@@ -789,7 +789,7 @@ however this will not: | |||
|
|||
```js | |||
let schema = number().test('is-42', "this isn't the number i want", (value) => | |||
Promise.resolve(value != 42), | |||
Promise.resolve(value === 42), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise.resolve(value === 42), | |
Promise.resolve(value == null || value === 42,), |
The logic in the "42" tests was backwards. It was checking that the number didn't equal 42, when it should check the number does equal 42.