import {expect} from 'chai'; import {test, suite} from 'mocha'; import {esc} from './xss.js'; suite('Server: XSS', () => { function testEsc(s: string, expected: string) { expect(esc(s)).to.equal(expected); } test('filter and escape', () => { testEsc('', ''); testEsc('foo bar!', 'foo bar!'); testEsc('', ''); testEsc('

foo

', 'foo'); testEsc('0 < 1 < 2', '0 < 1 < 2'); testEsc('/abc/123?foo=bar&baz', '/abc/123?foo=bar&baz'); }); });