import { sanitize } from "./sanitize"; describe("sanitize", () => { it("should sanitize the string input to HTML output", () => { let res = sanitize("foo"); expect(res.__html).toEqual("foo"); res = sanitize('Example.org'); expect(res.__html).toEqual('Example.org'); }); it("should not sanitize not allowed tags", () => { let res = sanitize( 'Before After' ); expect(res.__html).toEqual("Before After"); }); it("should accept options for rendering", () => { let res = sanitize( 'Example.org', { allowedAttributes: { a: ["href"] } } ); expect(res.__html).toEqual('Example.org'); }); });