I am failing the first challenge. I am using tests/1_unit-tests.js
Not sure, what’s going on here. It’s my first time using Chai.
assert.isNull('#isNull, #isNotNull', function(){
assert.fail(null, 'this is an optional error description - e.g. null is null');
assert.fail( 1, '1 is not null');
});
Here are the error logs.
// running test
expected undefined to equal ‘passed’
Cannot read property ‘0’ of undefined
Cannot read property ‘1’ of undefined
// tests completed
With all these kind of Chai challenges you are supposed to change the default assert.fail(...) into the test that they mention in the challenge. In this case it is assert.isNull(...) or assert.isNotNull(...). You have to figure out which one is the right test for each expected result.
I was wondering this too… I just ignored them By the way when you get to test 10 there is a spelling error… check that it says assert.approximately for both tests…because it doesnt…somehow the bugfix from march isnt on the master yet…
I’m also confused about how to complete this challenge.
I modified 1_unit_tests.js as follows:
/** 1 - Use assert.isNull() or assert.isNotNull() to make the tests pass. **/
test('#isNull, #isNotNull', function(){
assert.isNull(null, 'this is an optional error description - e.g. null is null');
assert.isNotNull( 1, '1 is not null');
});
Then I place my cursor at the beginning of this test, copy the glitch URL, and paste it into freeCodeCamp, but I receive the same error log as noted in the original post.
test(’#isNull, #isNotNull’, function(){
assert.isNull(null, ‘this is an optional error description - e.g. null is null’);
assert.isNotNull( 1, ‘1 is not null’);
});
Pulamusic: “It’s a bit irritatiing that the directions for these challenges aren’t more well written”
You hit the other nail on the head.
The deeper into these you go, the less and less useful information is given.
In a module called “Learn How JavaScript Assertions Work” no explination of what an assertion is, how they work, or how you would use one in a project is given.
The quality of the first lessons in FreeCodeCamp is incredible, but it falters and eventually just stops.
You’re right.
The url should be like this: https://zzzz-yyyy-xxxx.glitch.me
And the file should be called: tests/1_unit-tests.js , note each char that it contains.