1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 1x 1x 1x 1x 1x 1x 1x 1x 1x | import validJson from './validJson' describe('validJson', async () => { it('returns nothing for a valid JSON string', () => { const json = `{"valid": "json"}` const result = validJson(json) expect(result).toEqual(undefined) }) it('returns an error message for invalid JSON string', () => { const invalidJson = `{ invalid json }` const result = validJson(invalidJson) expect(result).toEqual('JSON needs to be valid') }) }) |