Metric-Imperial Converter - Quality Assurance

hello campers

Could you please help me, I have modified my code thousands of times trying to pass all the tests but no matter how hard I try and try, two always fail me and I can’t think of any more ideas to correct it.
This is my code:

And these are the two tests that fail:

Failed: If the number is invalid, returned will be ‘invalid number’.
Failed: If both the unit and number are invalid, returned will be ‘invalid number and unit’.

It is not in Replit since the projects there always fail me.
I thank you for your help.
Thank you


Hola Campistas

Me podrian por favor ayudar, he modificado mi codigo miles de veces tratando de pasar todas las pruebas pero por mas que intento e intento siempre me fallan dos ya no se me ocurren mas ideas para corregirlo.
Este es mi codigo:

Y estas son las dos pruebas que no pasan:

Failed: If the number is invalid, returned will be ‘invalid number’.
Failed: If both the unit and number are invalid, returned will be ‘invalid number and unit’.

No esta en Replit ya que los proyectos ahí siempre me fallan.
Agradezco su prota ayuda.
Gracias

Unable to access that Glitch project.

I think this is the issue with Glitch and the specific tests using // that gets stripped.

If you log out the input in the convertHandler it should be:

1//2gal
1//2min

But instead, it is:

1/2gal
1/2min

Not sure if there is a solution for this, other than maybe hardcoding the fix based on the two inputs.

The tests:

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

Edit: Also, if you open the Glitch console and submit do you not see this?

Cannot set headers after they are sent to the client

Adding returns to your res calls in the api.js file should fix that.


The Glitch link didn’t work for me at first either, but eventually, it did.

I’m sorry!
Try this please:

Thank you,
I will try to implement it to give a solution.
Greetings

Hello Campers, I have finally solved it, the only option that you accept for this challenge is Replit, my code was fine, I just did not take it well in Glinch

Good coding thanks for the attention.
This topic can now be closed :v: