Only passing 2 of 5 functional tests for Metric-Imperial Converter project

I’m only able to pass 2 of the five tests. The code failing the tests is

test('Convert 32g (invalid input unit)', function(done) {
        chai.request(server)
        .get('/api/convert')
        .query({input: '32g'})
        .end(function(err, res){
          assert.equal(res.status, 200);
          //assert.equal(res.body.initNum, 32);
          assert.equal(res.body.initUnit, "invalid unit");
          //assert.equal(res.body.returnNum, 32);  //121.13312
          //assert.equal(res.body.returnUnit, 'invalid unit');
          
          done();
        });
      });
      
      test('Convert 3/7.2/4kg (invalid number)', function(done) {
        chai.request(server)
        .get('/api/convert')
        .query({input: '3/7.2/4kg'})
        .end(function(err, res){
          assert.equal(res.status, 200);
          assert.equal(res.body.initNum, "invalid number");
          //assert.equal(res.body.initUnit, 'kg');
          //assert.equal(res.body.returnNum, "invalid number");
          //assert.equal(res.body.returnUnit, 'lbs');
          done();
        });
        
      });  
      
      test('Convert 3/7.2/4kilomegagram (invalid number and unit)', function(done) {
        chai.request(server)
        .get('/api/convert')
        .query({input: '3/7.2/4kilomegagram'})
        .end(function(err, res){
          assert.equal(res.status, 200);
          assert.equal(res.body.initNum, "invalid number");
          assert.equal(res.body.initUnit, "invalid unit");
          //assert.equal(res.body.returnNum, "invalid number");
          //assert.equal(res.body.returnUnit, "invalid unit");
          done();
        });
        
      });

I don’t know if it is a problem with the assertions. I think it may have something to do with the timing of the code execution and the code stopping before the tests finish running? But I could very well be wrong.
For example I’m getting

Uncaught AssertionError: expected undefined to equal 'invalid number'

But testing manually I know that the variables are not undefined.

My full code is here

I solved it, let it go for 9 days and voila solution came to me :grinning: