Get a Hint: Quality Assurance and Testing with Chai - Learn How JavaScript Assertions Work

Learn How JavaScript Assertions Work

I added a line in the hints to make it easier for new users to get started. “When submitting your solution, make sure that your code is running in the server so that the tests work.”

Proposal for new edit:

Problem Explanation

To begin, locate the file “tests/1_unit_tests.js”.

This file contains multiple suites of tests for the project, and this first challenge requires you to make the tests in /** 1 */ to pass.

When submitting your solution, make sure that your code is running in the server so that the tests work.


Hints

Hint 1

The two lines in the test should be changed from assert.fail() to either assert.isNull() or assert.isNotNull().


Solutions

Solution 1 (Click to Show/Hide)
/** 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');
});

Hello there,

Thank you, for taking the time to contribute.

I am interested in understanding why you have suggested this hint for this challenge in the curriculum?

Reason being: there are many challenges prior to this section which require campers to have the code running in the server, for the tests to work.

Were you caught off-guard by this? Did you skip some of the prior content in the curriculum?

1 Like

Haha, apparently I was caught off-guard because I had left for a bit and then skipped ahead to this section. This can be closed.

No worries, if you were caught off-guard. We can always look to improve expectation/communication throughout the curriculum.

I will leave this up, for now, in the hope that others will weigh-in. Potentially, there is some conversation to be had about adding something to the introduction of each block to clarify what “publicly visible” means.

For clarity, because it’s been some time since I tried these lessons… does the tests for the repl.it link work?

I can pass the test in repl.it itself for the first test, but pasting the link of the repl.it project does not pass the fcc tests.

Does someone have a link that works for the first challenge?

mine: https://repl.it/@paulywill/boilerplate-mochachai

Hey Paul,

What are you trying to clarify?

I have a Glitch which passes the tests: https://glitch.com/~quality-assurance-mocha-chai

If you are failing the e2e tests, it is likely because of this:

Hope this helps

The lesson now recommends Repl.it though, not Glitch.

Students will attempt with Repl.it

Further to my point here’s the results of the link you provided:

Correct, but the mechanism is the same.

You are not providing the correct link:

The link needed to be submitted is the link to the Live App. In my case:
https://quality-assurance-mocha-chai.glitch.me/

In your case: https://boilerplate-mochachai.paulywill.repl.co
(To expand: I passed with your project as well. You must ensure the app is running in the background, before submitting it)

Hope this clarifies

1 Like

That does.

I was using the link repl.it share button provided… not the URL of the running instance (ie the little preview).

Thank you.

1 Like