8dfd143208
* set up snapshot testing * improvements * add tests for TextInput as an example * Fix code style issues with ESLint * add comment to custom-test-env file * only set up needed providers * include style rules in snapshots * disable redux storage warning * added setupTests to avoid boilerplate Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
17 lines
580 B
JavaScript
17 lines
580 B
JavaScript
// Custom test environment to provide `TextEncoder`/`TextDecoder`
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const Environment = require('jest-environment-jsdom')
|
|
|
|
module.exports = class CustomTestEnvironment extends Environment {
|
|
async setup() {
|
|
await super.setup()
|
|
if (typeof this.global.TextEncoder === 'undefined') {
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const { TextEncoder, TextDecoder } = require('util')
|
|
this.global.TextEncoder = TextEncoder
|
|
this.global.TextDecoder = TextDecoder
|
|
}
|
|
}
|
|
}
|