question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

expect(null).to.be.within(0,10) does not fail assertion

See original GitHub issue

Expected behavior: expect(null).to.be.within(0,1) should return false for any numbers a and b.

Actual behavior: expect(null).to.be.within(0,1) returns true. Sam for other falsey values, I assume, and similar problem with true.

Proposed fix: Within should check that the value is a number and reject if it isn’t before comparing the range here.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:18 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
meebercommented, Apr 30, 2016

@vieiralucas Absolutely. In fact, it’s on Chai’s roadmap for 7.x.x to claim all of the world’s Lucases as contributors. With your contribution, we’ll be up to two! 😄

If you have any questions, doesn’t hesitate to ask. Also, please keep the PR in scope of what was agreed upon earlier in the thread (i.e., numbers-only).

2reactions
helfercommented, Apr 30, 2016

@vieiralucas It’s totally fine with me, and I don’ think anyone else would mind, so go ahead!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to assert not null? - javascript - Stack Overflow
It's often best to assert that the one expected output was produced, rather than asserting that one of countless unexpected outputs wasn't produced....
Read more >
Expect - Jest
The expect function is used every time you want to test a value. You will rarely call expect by itself. Instead, you will...
Read more >
API Reference - Chai Assertion Library
Chai is a BDD / TDD assertion library for [node](http://nodejs.org) and the browser that can be delightfully paired with any javascript testing framework....
Read more >
What is the assert.isNotNull() method in Chai.js? - Educative.io
If the value is null, then nothing is returned, meaning the test was successful. However, if an error is thrown, then it was...
Read more >
Assert - Chai
Asserts that value is null. assert.isNull(err, 'there was no error'); ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found