Given the code:
import { getLocale } from './locale';
export const euro = (priceData: number): string => {
const priceFormatter = new Intl.NumberFormat(getLocale(), {
style: 'currency',
currency: 'EUR',
});
return priceFormatter.format(priceData);
}
export default null;
and the related test:
import { euro } from './currency';
test('euro', () => {
expect(euro(42)).toBe("42,00 €");
});
Jest says:
Even if I copy-paste the expected result of Jest to my assert, the error is still the same.
So the question is: Why the hell? :-D
Space is the area beyond the upper limits of Earth’s atmosphere. It is where all of the asteroids, comets, planets, stars, solar systems and galaxies in our universe are found. Space is a vacuum, meaning it contains almost nothing, but it is not completely empty. Interesting Facts about Space
Interesting Facts about Space Space does not begin at a specific altitude above the Earth, but the Kármán line at 100 km is a commonly used definition. The temperature in the void of space is about −270.45 °C. Space is a hard vacuum, meaning it is a void containing very little matter.
The other few places you might see spaces in Japanese are also edge cases. If something is written in romaji, spaces are used just like with English. As noted earlier, while hiragana, kanji and katakana are full-width fonts, romaji is half-width. This means spaces are necessary between words to aid in clarity.
Scientific, historical and cultural facts about space, galaxies, the planets and other objects in the solar system. The latest discoveries and interesting space related features can be found on the blog, while the gallery highlights graphics and diagrams that illustrate more aspects of the the universe.
You want this test to assert:
"42,00\xa0€"
It's not a space (different ascii code / unicode). According to a jest issue about string comparison being incorrect Intl.NumberFormat
uses a non-breaking space.
And as pointed out in a similar question's answer:
NumberFormat use small non-breaking space (
\u202f
) for thousand separator and normal non-breaking space beforece currency (\xa0
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With