import Setting from '@joplin/lib/models/Setting'; import { processPastedHtml } from './resourceHandling'; describe('resourceHandling', () => { it('should sanitize pasted HTML', async () => { Setting.setConstant('resourceDir', '/home/.config/joplin/resources'); const testCases = [ ['Test: ', 'Test: '], ['test', 'test'], ['test', 'test'], ['evil.pdf', 'evil.pdf'], ['evil()', ''], ['', ''], [ '', '', ], ]; for (const [html, expected] of testCases) { expect(await processPastedHtml(html)).toBe(expected); } }); });