【发布时间】:2017-12-28 03:06:51
【问题描述】:
我正在开发一个 angular(2.4.0)/typescript 应用程序,该应用程序使用自定义货币管道,该管道在内部使用 angular 的内置 CurrencyPipe 来格式化两个“en-CA”的输入货币字符串和“fr-CA”加拿大语言环境。在为法语案例编写单元测试时,对于期望给定有效输入字符串的格式化输出的快乐路径案例,
describe('for French locale', () => {
// get the mock custom currency pipe instance for 'fr-CA' locale as 'currencyPipeForFR'
it('should be formatted for fr-CA locale', () => {
expect(currencyPipeForFR.transform('7500')).toBe('7 500 $');
});
});
我收到此错误,
Expected '7 500 $' to be '7 500 $'.
我确实检查了转换结果的 instance of,它是 String。我错过了什么?任何帮助将不胜感激。
【问题讨论】:
标签: angular typescript jasmine pipe separator