import escape from '../escape' describe('escape', () => { const htmlEscapes = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/', } it('should escape each character', () => { for (let [char, escapedChar] of Object.entries(htmlEscapes)) { expect(escape(char)).toBe(escapedChar) } }) it('should escape multiple characters', () => { expect(escape('& and < and > and " and \' and /')).toBe( '& and < and > and " and ' and /' ) }) })