import parseJson from '../parseJson'; describe('parseJson', () => { it('should parse a json string', () => { const j = parseJson('{"foo": "bar"}'); expect(j).toEqual({ foo: 'bar' }); }); it('should not parse json and return original value', () => { const j = parseJson('plain text'); expect(j).toBe('plain text'); }); });