String Comparison Incorrect
See original GitHub issue🐛 Bug Report
When comparing the string "1.234,56 CHF"
to "1.234,56 CHF"
(apparently identical) Jest is coming up with not equal. It boils down to JavaScript being weird in that "1.234,56 CHF" == String("1.234,56 CHF")
is apparently false.
jasmineUtils.js:
envinfo
System:
OS: Windows 10 10.0.16299
CPU: (4) x64 Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
Binaries:
Node: 13.2.0 - C:\prg\nodejs\node.EXE
Yarn: 1.5.1 - C:\prg\yarn\bin\yarn.CMD
npm: 6.13.1 - C:\prg\nodejs\npm.CMD
npmPackages:
jest: ^24.9.0 => 24.9.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
CWE-597: Use of Wrong Operator in String Comparison (4.9)
The product uses the wrong operator when comparing a string, such as using "==" when the .equals() method should be used instead. +...
Read more >java - Comparing two identical strings with == returns false
In your code, you are comparing an Object with a String literal (also an object), which is not the same as comparing the...
Read more >Incorrect string equality operator - AWS Documentation
Use equals() , not == , when checking if two strings are equal. This ensures strings that have the same value are treated...
Read more >Comparing Strings in Java - Baeldung
The method returns true if two Strings are equal by first comparing them using their address i.e “==”. Consequently, if both arguments are...
Read more >String.Compare Method (System) - Microsoft Learn
The comparison terminates when an inequality is discovered or both substrings have been compared. However, if the two strings compare equal to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jeysal @cawoodm What do you think about this quick and dirty prototype using ES2018 RegExp Unicode property escapes (in Node 8 with
--harmony_regexp_property
flag and in Node 10 without flag) to detect replacement of adjacent characters which have General_Category=Space_Separator and format the code point (if either or both are not space).There are probably some more low-hanging fruit like delete or insert of zero-width characters.
Baseline at left and imagined relevant comparison at right:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.