From e467a517fed49a78d9d19c066f1f33a6b4c8381a Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Tue, 20 Nov 2018 10:15:40 +0100 Subject: [PATCH] removed fdescribe + refactor --- .../core/src/filters/specs/currency.spec.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/client/core/src/filters/specs/currency.spec.js b/client/core/src/filters/specs/currency.spec.js index 38e4e19db..fa6ba24f2 100644 --- a/client/core/src/filters/specs/currency.spec.js +++ b/client/core/src/filters/specs/currency.spec.js @@ -1,4 +1,4 @@ -fdescribe('Currency filter', () => { +describe('Currency filter', () => { let compile; let $element; @@ -11,17 +11,31 @@ fdescribe('Currency filter', () => { }); }; - it('should return the value formatted with two decimals when the value is a number and you set it a 2 as param', () => { + it('should return a ONE decimal number as per the argument', () => { + let html = `
{{200 | currency: '€': 1}}
`; + compile(html); + + expect($element[0].innerHTML).toEqual('200.0 €'); + }); + + it('should return a TWO decimals number as per the argument', () => { let html = `
{{200 | currency: '€': 2}}
`; compile(html); - expect($element[0].innerHTML).toBe('200.00 €'); + expect($element[0].innerHTML).toEqual('200.00 €'); + }); + + it('should return a TEN decimals number as per the argument', () => { + let html = `
{{200 | currency: '€': 10}}
`; + compile(html); + + expect($element[0].innerHTML).toEqual('200.0000000000 €'); }); it('sould return nothing when the value is not set', () => { let html = `
{{null | currency: '€': 2}}
`; compile(html); - expect($element[0].innerHTML).toBe(''); + expect($element[0].innerHTML).toEqual(''); }); });