I have been developing a web application using Angular (version 2.4.0) and TypeScript. The application utilizes a custom currency pipe, which leverages Angular's built-in CurrencyPipe to format currency strings for both the 'en-CA' and 'fr-CA' Canadian locales. During the process of writing unit tests for the French locale, specifically when testing the scenario where the expected output is a properly formatted currency string for a valid input, I encountered an issue.
describe('for French locale', () => {
// obtain the mock instance of the custom currency pipe for 'fr-CA' locale as 'currencyPipeForFR'
it('should be formatted for fr-CA locale', () => {
expect(currencyPipeForFR.transform('7500')).toBe('7 500 $');
});
});
The error message I received was:
Expected '7 500 $' to be '7 500 $'.
Upon verifying that the transformed result is indeed a String
, I am puzzled as to what could be causing this discrepancy. Any guidance on resolving this issue would be greatly appreciated.