My calculator works fine, but doesn't pass the tests

Hey there,

i am new to this forum and to freecodecamp.
I use the challenges to build myself a great portfolio-website and till the drum-machine and the calculator it went really well.
Why the drum-machine isn’t passing the tests, i know (because i used a complete different programming approach) but why my Calculator is not passing all the tests, i have no idea :confused: … it will be great, to get some feedback or hints, what i have to change, to pass the tests.

here is my calculator project:

Calculator: React App
GitHub - LE-Smith/freecodecamp-calculator

Looking forward to some feedback,

Hey Stephan,

nice to meet you! :wave:

It’s a good idea to show us which errors you get.

You can show us your live project including the tests live on codesandbox.

You can have a look at the tests.

Okay, might be a longshot, but I believe you have “misspelled” your display in your code.
Try removing and retype the text id="display" in your display <div></div>, and test again.
As I see it, all the tests fail because it sees your display as “0” after inputting values according to the tests it makes.

When I searched through the HTML in my browser, I tried to search for id="display", but were unable to make it find your div - despite finding it manually.

Also found a slight issue when I tried out your calculator - If you type in a number that contains a 0 after the decimal point, such as “5.607”, in the display it removes the 0 but in the formula div it still displays correctly.


hi miku86,
sure, i forked it to Codesandbox: festive-waterfall-4u5w3 - CodeSandbox

I get the errors: 8, 9, 11, 12, 13, 14, 15

and thanks for the link with the tests. I will have a look in it :slight_smile:

hi Andreas,
thank you for the feedback. The thing with the removed zero i did not test. Will bugfix it :slight_smile:

@LE-Smith, when tests fail click the red button to see which test(s) are failing and text to help you correct the issue.

  • Be sure and read more than just the first line of the failing message. The ability to read and comprehend error messages is a skill you’ll need to acquire as a developer. Ask questions on what you don’t understand.