Sudoku Solver - All unit tests are passing but FCC won't accept as "complete and passing"

Tell us what’s happening:
All my unit tests pass but for some reason FCC says I don’t have all 12 unit tests complete and passing.

Can someone tell me which test or assertion I am missing?

Your code so far

const chai = require('chai');
const assert = chai.assert;
const expect = chai.expect;

const Solver = require('../controllers/sudoku-solver.js');
let solver;

suite('UnitTests', () => {
  suiteSetup(() => {
    solver = new Solver();
  });
  
  const VALID_PUZZLE = "..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..";
  const UNSOLVABLE_PUZZLE = "1.9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..";
  const INVALID_LENGTH = "..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..";
  const INVALID_CHARACTER = "ab9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..";
  const VALID_SOLUTION = "769235418851496372432178956174569283395842761628713549283657194516924837947381625";
  const INVALID_SOLUTION = "169235418851496372432178956174569283395842761628713549283657194516924837947381625";
  test("Valid puzzle", function() {
    assert.equal(solver.validate(VALID_PUZZLE), true);
  });
  test("Invalid characters in puzzle", function() {
    expect(() => { solver.validate(INVALID_CHARACTER) }).to.throw();
  });
  test("Invalid length puzzle", function() {
    expect(() => { solver.validate(INVALID_LENGTH) }).to.throw();
  });
  test("Valid row placement", function() {
    assert.equal(solver.checkRowPlacement(VALID_PUZZLE, 0, 0, 7), true);
  });
  test("Invalid row placement", function() {
    assert.equal(solver.checkRowPlacement(VALID_PUZZLE, 0, 0, 1), false);
  });
  test("Valid column placement", function() {
    assert.equal(solver.checkColPlacement(VALID_PUZZLE, 0, 0, 7), true);
  });
  test("Invalid column placement", function() {
    assert.equal(solver.checkColPlacement(VALID_PUZZLE, 0, 0, 1), false);
  });
  test("Valid region placement", function() {
    assert.equal(solver.checkRegionPlacement(VALID_PUZZLE, 0, 0, 7), true);
  });
  test("Invalid region placement", function() {
    assert.equal(solver.checkRegionPlacement(VALID_PUZZLE, 0, 0, 2), false);
  });
  test("Valid completed puzzle passes solver", function() {
    assert.equal(solver.solve(VALID_SOLUTION), VALID_SOLUTION);
  });
  test("Invalid completed puzzle fails the solver", function() {
    expect(() => { solver.solve(INVALID_SOLUTION) }).to.throw(Error, "Puzzle cannot be solved");
  });
  test("Expected solution for valid incomplete puzzle", function() {
    assert.equal(solver.solve(VALID_PUZZLE), VALID_SOLUTION);
  });
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36

Challenge: Sudoku Solver

Link to the challenge:

It seems FCC’s test validation does not count expect(<function>).to.throw() as a complete test. I was able to solve the issue by including an additional assertion test (assert.<test>()) where I was only previously checking for an error to be thrown. The simplest assertion I could come up with was assert.isTrue(true).

(post deleted by author)

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