I have written the sudoku-solver.js
and api.js
code and all the tests are passing.
I am now trying to write the first Unit Test and have written:
const chai = require('chai');
const assert = chai.assert;
const Solver = require('../controllers/sudoku-solver.js');
let solver = new Solver();
suite('Unit Tests', () => {
test('Logic handles a valid puzzle string of 81 characters', function (done) {
assert.equal(solver.validate('..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'), { result: true });
done();
});
});
This doesn’t work and I get the following:
npm run start
> sudoku-solver@2.0.0 start
> nodemon server.js
[nodemon] 2.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
Listening on port 3000
Running Tests...
Unit Tests
1) Logic handles a valid puzzle string of 81 characters
0 passing (14ms)
1 failing
1) Unit Tests
Logic handles a valid puzzle string of 81 characters:
AssertionError: expected { result: true } to equal { result: true }
+ expected - actual
at Context.<anonymous> (tests/1_unit-tests.js:9:12)
at processImmediate (node:internal/timers:471:21)
signal: terminated
Looks to me like the expected and actual are the same
Your project link(s)
solution: boilerplate-project-sudoku-solver - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Challenge: Quality Assurance Projects - Sudoku Solver
Link to the challenge: