Skip to content

Fixed logic in "42" tests#2203

Open
rmc29 wants to merge 1 commit into
jquense:masterfrom
rmc29:patch-1
Open

Fixed logic in "42" tests#2203
rmc29 wants to merge 1 commit into
jquense:masterfrom
rmc29:patch-1

Conversation

@rmc29

@rmc29 rmc29 commented Apr 19, 2024

Copy link
Copy Markdown

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.

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.
Comment thread README.md
'is-42',
"this isn't the number i want",
(value) => value != 42,
(value) => value === 42,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(value) => value === 42,
(value) => value == null || value === 42,

Copy link
Copy Markdown
Author

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?

Copy link
Copy Markdown
Owner

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

Comment thread README.md
```js
let schema = number().test('is-42', "this isn't the number i want", (value) =>
Promise.resolve(value != 42),
Promise.resolve(value === 42),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Promise.resolve(value === 42),
Promise.resolve(value == null || value === 42,),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants