Quality Assurance Projects - Metric-Imperial Converter

Tell us what’s happening:
Describe your issue in detail here.

Please help me figure out what’s wrong!
When I enter “npm run test” here’s the output:

Running Tests…

Unit Tests
√ convertHandler should correctly read a whole number input.
√ convertHandler should correctly read a decimal number input.
√ convertHandler should correctly read a fractional input.
√ convertHandler should correctly read a fractional input with a decimal.
√ convertHandler should correctly return an error on a double-fraction (i.e. 3/2/3).
√ convertHandler should correctly default to a numerical input of 1 when no numerical input is provided.
√ convertHandler should correctly read each valid input unit.
√ convertHandler should correctly return an error for an invalid input unit.
√ convertHandler should return the correct return unit for each valid input unit.
√ convertHandler should correctly return the spelled-out string unit for each valid input unit.
√ convertHandler should correctly convert gal to L.
√ convertHandler should correctly convert L to gal.
√ convertHandler should correctly convert mi to km.
√ convertHandler should correctly convert km to mi.
√ convertHandler should correctly convert lbs to kg.
√ convertHandler should correctly convert kg to lbs.

Functional Tests
√ Convert a valid input such as 10L: GET request to /api/convert. (47ms)
√ Convert an invalid input such as 32g: GET request to /api/convert.
√ Convert an invalid number such as 3/7.2/4kg: GET request to /api/convert.
√ Convert an invalid number AND unit such as 3/7.2/4kilomegagram: GET request to /api/convert.
√ Convert with no number such as kg: GET request to /api/convert.

21 passing (154ms)

0 passing (1ms)

As you can see the functional test appear to pass but… what? It’s counting as a unit test? The suite returns before the tests? That and something else?

I’m guessing the main problem is that the suite is returning before the tests in it actually return.

But in my 2_functional-test.js I have:

suite('Functional Tests', function() {
    this.timeout(5000);
    test('Convert a valid input such as 10L: GET request to /api/convert.', function(done) {
        chai.request(server)
            .get('/api/convert')
            .query({input: '10L'})
            .end(function(err, res) {
                let expected = {"initNum":10,"initUnit":"L","returnNum":2.64172,"returnUnit":"gal","string":"10 liters converts to 2.64172 gallons"};
                assert.equal(res.status, 200);
                assert.deepEqual(res.body, expected, 'res.body is deepEqual to expected');
                done();
            });
    });
    Other test here... etc

I’m using this.timeout(5000) and passing done to the test and executing done at the end(). I don’t know what else to do…

Any clues, suggestions, help or advice is welcome…
Maybe it’s nothing to do with 2_functional-test.js??
Thanks in advance :slight_smile:

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0

Challenge: Quality Assurance Projects - Metric-Imperial Converter

Link to the challenge:

I’m already passing the test!
The only thing I did was copy my code to replit.
Maybe the problem was because I was running the test locally??
Either way. Cheers :partying_face: