sanitizer-polyfill icon indicating copy to clipboard operation
sanitizer-polyfill copied to clipboard

Set up a test framework to create and run unit and integration tests

Open 0xedward opened this issue 4 years ago • 1 comments

As of right now, we will need to write unit tests for functions in src/sanitizer.js and integration tests for Sanitizer methods.

We might be able to draw inspiration from the testing setup and the test cases in DOMPurify

0xedward avatar Jul 07 '21 04:07 0xedward

Copying from tests/TODO:

ideally:
- clone wpt from https://github.com/web-platform-tests/wpt
- open a browser that is configured to run wpt
- figure out how to execute the polyfill on every site
- run the wpt tests for the sanitizer-api subfolder
Note: it looks like the trusted-types repo is doing that at https://github.com/w3c/webappsec-trusted-types/tree/main/tests/platform-tests

practically (short term)
- clone test cases from https://github.com/web-platform-tests/wpt/blob/master/sanitizer-api/support/testcases.sub.js
- DIY test-framework that uses the test cases, start with sanitize() function only.

0xedward avatar Jul 11 '21 00:07 0xedward