Skip to content
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

Reference value NaN assertion. #94

Closed
wants to merge 3 commits into from

Conversation

@GaneshSPatil
Copy link
Contributor

GaneshSPatil commented Nov 18, 2016

To check whether the reference value is NaN or not.

For Example:

expect(NaN).to.be.NaN();
expect(1).not.to.be.NaN();
Copy link
Contributor

cjihrig left a comment

There is a difference between the behavior of isNaN() and Number.isNaN(). Since this is only targeting the NaN value, this should use Number.isNaN(). Please add a test that asserts a string to see the difference.

API.md Outdated
@@ -301,6 +302,17 @@ const expect = Code.expect;
expect(undefined).to.be.undefined();
```

##### `NaN()`

Asserts that the reference value is NaN.

This comment has been minimized.

Copy link
@cjihrig

cjihrig Nov 18, 2016

Contributor

NaN should be in backticks.

@@ -195,6 +195,12 @@ internals.addMethod('error', function (/*type, message*/) {
});


internals.addMethod('NaN', function () {

return this.assert(isNaN(this._ref), 'be NaN');

This comment has been minimized.

Copy link
@cjihrig

cjihrig Nov 18, 2016

Contributor

isNaN() -> Number.isNaN()

@GaneshSPatil GaneshSPatil force-pushed the GaneshSPatil:nan-value branch from 8216913 to cca691f Nov 18, 2016
@cjihrig

This comment has been minimized.

Copy link
Contributor

cjihrig commented Nov 18, 2016

This still needs a test for a string.

@GaneshSPatil GaneshSPatil force-pushed the GaneshSPatil:nan-value branch from cca691f to 1de2fa0 Nov 19, 2016
@cjihrig cjihrig added the feature label Nov 23, 2016
@cjihrig cjihrig added this to the 4.1.0 milestone Nov 23, 2016
@cjihrig cjihrig self-assigned this Nov 23, 2016
@cjihrig

This comment has been minimized.

Copy link
Contributor

cjihrig commented Nov 23, 2016

Landed with some edits in 3d9dfc3.

@cjihrig cjihrig closed this Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.