refactor(ccdaservice): extract and test safeTrim function (#6788)
[openemr.git] / ccdaservice / utils / safe-trim / safe-trim.spec.js
blob45071c3f68f8570121a5f05f75801e76942f980e
1 const safeTrim = require('./safe-trim').safeTrim;
3 describe('safeTrim', () => {
4     it('should trim the input if the input is a string', () => {
5         expect(safeTrim('   ABC ')).toEqual('ABC');
6     });
8     test.each([null, undefined, 10, {}, true])(
9         `for input of same type as %p, it should return the input without modifications`,
10         (input) => {
11             expect(safeTrim(input)).toEqual(input);
12         }
13     );
14 });