File size: 383 Bytes
b694417
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import { describe, expect, it } from "vitest";

import { escapeHtml } from "./graphHtml";

describe("escapeHtml", () => {
  it("escapes entity and relation labels before the graph library renders HTML", () => {
    expect(escapeHtml("<img src=x onerror=\"alert(1)\"> & 'quoted'")).toBe(
      "&lt;img src=x onerror=&quot;alert(1)&quot;&gt; &amp; &#39;quoted&#39;",
    );
  });
});