Quality Assurance Projects - Metric-Imperial Converter

Tell us what’s happening:

I have created a working solution and deployed it on render.com. Link to solution can be found here: https://fcc-quality-assurance-metric-imperial.onrender.com

Github link: GitHub - mger1608/fcc-quality-assurance-metric-imperial-converter

All 21 tests pass when I run on both my machine and deploy on render.com

When I test the solution on freeCodeCamp, all the unit tests pass, but test ‘12. All 16 unit tests are complete and passing.’ fails.

I have no idea why this might be the case as there is no error thrown on freeCodeCamp and all the tests pass on my machine and Render.com

###Your project link(s)

solution: https://fcc-quality-assurance-metric-imperial.onrender.com

githubLink: GitHub - mger1608/fcc-quality-assurance-metric-imperial-converter

Your browser information:

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

Challenge Information:

Quality Assurance Projects - Metric-Imperial Converter

I ran the solution and the github link and had the same results as you, the inspector console is throwing this error you may take a look at that, but I`m unsure if this is the problem.

Put all the tests inside the "Unit Tests" callback.

suite("Unit Tests", function () {
  // all tests
}

Well done to you. I never would have noticed that. Thanks!

1 Like

It wasn’t obvious. To understand why it is failing, I looked at the tests and how the length is checked (i.e. the “numbers” of tests passing).

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md

async () => {
  try {
    const getTests = await $.get(code + '/_api/get-tests');
    assert.isArray(getTests);
    const unitTests = getTests.filter(test => {
      return !!test.context.match(/Unit Tests/gi);
    });
    assert.isAtLeast(unitTests.length, 16, 'At least 16 tests passed');
    unitTests.forEach(test => {
      assert.equal(test.state, 'passed', 'Tests in Passed State');
      assert.isAtLeast(
        test.assertions.length,
        1,
        'At least one assertion per test'
      );
    });
  } catch (err) {
    throw new Error(err.responseText || err.message);
  }
};
1 Like