Quality Assurance Projects - Sudoku Solver

Tell us what’s happening:
So I’m working on the Sudoku solver project and I’m passing all tests except two:

1.) If value submitted to /api/check is already placed in puzzle on that coordinate, the returned value will be an object containing a valid property with true if value is not conflicting.

2.) If the value submitted to /api/check is not a number between 1 and 9, the returned value will be { error: 'Invalid value' }

I believe I have checks for these in my api.js under the api/check route but I’m still getting errors for these two tests. the errors are as follows for test 1 and 2 respectively:

1.) [Error: expected { status: ‘unavailable’ } to be an array]
2.) [Error: expected { status: ‘unavailable’ } to be an array]

Any help would be appreciated. Thanks in advance!

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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36

Challenge: Quality Assurance Projects - Sudoku Solver

Link to the challenge:

UPDATE: Now the only test Im not passing is this:

If value submitted to /api/check is already placed in puzzle on that coordinate , the returned value will be an object containing a valid property with true if value is not conflicting.

and the error is:
[Error: expected { status: ‘unavailable’ } to be an array]
[Error: expected { status: ‘unavailable’ } to be an array]

Im very lost how to address this. any help would be apprecated.

Thanks in advance!

All I know is that it is expecting a {"valid":true} response for that request. I don’t know Sudoku and I’m not about to learn the rules and check your logic for it.


Here are the tests as well if needed.

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/sudoku-solver.md

Yes, this is the issue. There needs to be logic somewhere (perhaps within the code below?) which returns {"valid":true} if the user-submitted co-ordinates and value match what is already in the grid.

For instance, if you enter ‘B1’ and ‘8’ in the initial grid, your code is returning { "valid": false, "conflict": [ "row", "column", "region" ] }. In this case, where there is already an ‘8’ in that grid square, the test requires you to return {"valid":true}.

if (validCol && validReg && validRow) {
      res.json({ valid: true });
      return;
    } else {
      if (!validRow) {
        conflicts.push("row");
      }
      if (!validCol) {
        conflicts.push("column");
      }
      if (!validReg) {
        conflicts.push("region");
      }
      res.json({ valid: false, conflict: conflicts });
      return;
    }

yes, that was the issue. I was checking if the value !=0, not matching the user value and value already there.

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