import { expect, test } from 'vitest'
import * as xss from '../index'
test('测试 filterUrl,filterHtml, 整个组件库只用到这2个函数', async () => {
const { filterHtml, filterUrl } = xss.default
expect(filterHtml(`<a href="javascript:alert('XSS')">Click Me</a>`)).toMatchInlineSnapshot(`"<a href>Click Me</a>"`)
expect(filterUrl(`hello\uFEFFworld`)).toMatchInlineSnapshot(`"helloworld"`)
expect(filterUrl(`javascript:alert('XSS')`)).toMatchInlineSnapshot(`""`)
expect(filterUrl(`data:text/html,<h1>xss</h1>`)).toMatchInlineSnapshot(`""`)
expect(filterUrl(`https://s.com/user`)).toMatchInlineSnapshot(`"https://s.com/user"`)
})