Calculator Project Failing Tests

Hello there! I’ve been working on my calculator project and honestly it has been frustrating. Some tests fail, even when the suggested expression and output matches with the expression and output of when I input it manually.

Can someone point out what am i doing wrong?

Here’s my code on CodePen. Btw, theres no styling yet…I’m focusing on make it work first.
arenodi Calculator Project

You can see the test results here to find out what failed.
Test9: If you try ‘6+2*2=’ you get 12 instead of 10. You need to allow chaining of operations of any length before evaluation ‘=’
Try to satisfy all the test requirements.

That’s my point.

This is what the test warns:

The expression 5 - 9 + 5 should produce a result of 1
AssertionError: The expression 5 - 9 + 5 should produce a result of 1

And here is what happens when I input the same expression manually:

The expression is evaluated correctly.

*Edit: changed the reference img.

The bug was that when the test would try to insert a new value after pressing equals, the expression would keep an equal sign (“=”) failing to be evaluated by the math lib.
I just fixed that and all 16 tests went through. :pray:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.