How to tell Jest that spaces are in fact, spaces?

Viewed 1934

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:

Screenshot of Jest complaining that the string are not equal even though both are seemingly the same string. Error is on the space in between number and currency produced by the Intl component.

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

1 Answers
Related