Число, отформатированное в строку стиля валюты, возвращает значение, не эквивалентное ожидаемому.
const expected = `12,09 €`;
const formatted =
new Intl.NumberFormat(`de-De`, { style: `currency`, currency: `EUR` }).format(12.09);
expect(formatted).toEqual(expected); // Fail
expected === formatted; // false
// Logged values
console.log(`FORMATTED: type = ${typeof formatted}, value = '${actual}';`);
console.log(`EXPECTED: type = ${typeof expected}, value = '${expected}';`);
// FORMATTED: type = string, value = '12,09 €';
// EXPECTED: type = string, value = '12,09 €';
Но
new Intl.NumberFormat(`de-De`, { style: `currency`, currency: `EUR` }).format(12.09);
// returns "12,09 €"
`12,09 €` === `12,09 €`; // true
typeof formatted; // "string"
Вопрос: почему две одинаковые строки не равны?