Sudoku Solver: Failing one test, please help!

Hi everyone, I’m stuck on the Sudoku project as I’m getting an error on the following test:

“All 12 unit tests are complete and passing. See /tests/1_unit-tests.js for the expected behavior you should write tests for.”

When I check the console I see the following message:

Error: At least one assertion per test: expected 0 to be at least 1

I’m quite baffled as all the tests are passing on my local environment all of my tests have 1 assertion so I don’t understand what I’ve done wrong.

My unit tests file is here:
https://github.com/peterfknparker/boilerplate-project-sudoku-solver/blob/master/tests/1_unit-tests.js

Please could someone take a look? I’d really appreciate some assistance.

solution: https://sudukupfp.herokuapp.com

Best regards

I solved my issue. After looking into how FCC was running the test, I noticed that any test where I had relied on assert.throws was not being recognised as an assertion.

This is a bit annoying as I am quite sure that assert.throws is a legitimate check in Chai and it meant I had to go through my code to remove all of my error throws and rework my tests and api accordingly.

I’ve used assert.throws in some other FCC projects and haven’t had the same issue so not sure why it’s just not working here.

Anyway I’ve finally passed the tests. One more project to go before I’ve completed all the JS stuff :smiley:

1 Like

I had exactly this issue - I ended up adding

assert.isTrue(true);

to all my tests that relied upon assert.throws - not the most elegant solution but it did the trick - this would seem to be something that is ripe for improvement…

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.