import { convertStringToPrimitive, } from './type-conversion.functions'; describe('convertStringToPrimitive', () => { test('Returns the number representation of numbers', () => { const result = convertStringToPrimitive( '5', 'number', ); expect(result).toBe(5); }); // tslint:disable-next-line test('Returns true if the string is true and we tell the function it is a boolean type', () => { const result = convertStringToPrimitive( 'true', 'boolean', ); expect(result).toBe(true); }); // tslint:disable-next-line test('Returns false if the string is false and we tell the function it is a boolean type', () => { const result = convertStringToPrimitive( 'false', 'boolean', ); expect(result).toBe(false); }); // tslint:disable-next-line test('Returns the value of the string if we do not say the type is boolean or number', () => { const result = convertStringToPrimitive( 'some value', 'object', ); expect(result).toBe('some value'); }); });