From 3d12b541c488ea09efced2fb987fcbf384c656bb Mon Sep 17 00:00:00 2001 From: Johann-S Date: Wed, 2 Oct 2019 11:43:54 +0200 Subject: return to the original file structure to avoid breaking modularity --- js/src/util/sanitizer.spec.js | 70 ------------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 js/src/util/sanitizer.spec.js (limited to 'js/src/util/sanitizer.spec.js') diff --git a/js/src/util/sanitizer.spec.js b/js/src/util/sanitizer.spec.js deleted file mode 100644 index 6dadd29a5..000000000 --- a/js/src/util/sanitizer.spec.js +++ /dev/null @@ -1,70 +0,0 @@ -import { DefaultWhitelist, sanitizeHtml } from './sanitizer' - -describe('Sanitizer', () => { - describe('sanitizeHtml', () => { - it('should return the same on empty string', () => { - const empty = '' - - const result = sanitizeHtml(empty, DefaultWhitelist, null) - - expect(result).toEqual(empty) - }) - - it('should sanitize template by removing tags with XSS', () => { - const template = [ - '
', - ' Click me', - ' Some content', - '
' - ].join('') - - const result = sanitizeHtml(template, DefaultWhitelist, null) - - expect(result.indexOf('script') === -1).toEqual(true) - }) - - it('should allow aria attributes and safe attributes', () => { - const template = [ - '
', - ' Some content', - '
' - ].join('') - - const result = sanitizeHtml(template, DefaultWhitelist, null) - - expect(result.indexOf('aria-pressed') !== -1).toEqual(true) - expect(result.indexOf('class="test"') !== -1).toEqual(true) - }) - - it('should remove not whitelist tags', () => { - const template = [ - '
', - ' ', - '
' - ].join('') - - const result = sanitizeHtml(template, DefaultWhitelist, null) - - expect(result.indexOf('