From 0467c41fc5ce58e9adc665be398f728f0bb57504 Mon Sep 17 00:00:00 2001 From: Zachary Hueras Date: Fri, 17 Nov 2023 20:22:59 -0500 Subject: [PATCH] fix: update tests after dep upgrades --- packages/core/jest.config.js | 1 + packages/core/setup-tests.js | 4 ++++ packages/core/test/components/mapper/array.test.js | 3 --- packages/core/test/components/mapper/checkbox.test.js | 1 - packages/core/test/components/mapper/date.test.js | 1 - packages/core/test/components/mapper/fieldset.test.js | 1 - packages/core/test/components/mapper/integer.test.js | 1 - packages/core/test/components/mapper/number.test.js | 1 - packages/core/test/components/mapper/select.test.js | 1 - packages/core/test/general.test.js | 1 - packages/decorator-mui/src/__tests__/mui.test.js | 2 -- 11 files changed, 5 insertions(+), 12 deletions(-) create mode 100644 packages/core/setup-tests.js diff --git a/packages/core/jest.config.js b/packages/core/jest.config.js index 678efc97..8606069c 100644 --- a/packages/core/jest.config.js +++ b/packages/core/jest.config.js @@ -1,5 +1,6 @@ module.exports = async () => { return { + setupFilesAfterEnv: ['/setup-tests.js'], rootDir: __dirname, reporters: ['default', 'jest-summary-reporter'], testPathIgnorePatterns: [ diff --git a/packages/core/setup-tests.js b/packages/core/setup-tests.js new file mode 100644 index 00000000..0ceaa485 --- /dev/null +++ b/packages/core/setup-tests.js @@ -0,0 +1,4 @@ +import '@testing-library/jest-dom'; +import { TextEncoder, TextDecoder } from 'util'; +global.TextEncoder = TextEncoder; +global.TextDecoder = TextDecoder; diff --git a/packages/core/test/components/mapper/array.test.js b/packages/core/test/components/mapper/array.test.js index 38a02140..e4dd1f43 100644 --- a/packages/core/test/components/mapper/array.test.js +++ b/packages/core/test/components/mapper/array.test.js @@ -1,7 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import { ArrayComponent } from '../../../src/components/mapper/array'; -import '@testing-library/jest-dom/extend-expect'; -import shortid from 'shortid'; import { SchemaForm, util, constants } from '../../../src'; import React from 'react'; diff --git a/packages/core/test/components/mapper/checkbox.test.js b/packages/core/test/components/mapper/checkbox.test.js index 32afb16c..100dbd14 100644 --- a/packages/core/test/components/mapper/checkbox.test.js +++ b/packages/core/test/components/mapper/checkbox.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import * as barebones from '@forml/decorator-barebones'; import { SchemaForm, getLocalizer, util } from '../../../src'; diff --git a/packages/core/test/components/mapper/date.test.js b/packages/core/test/components/mapper/date.test.js index 74098949..af26e0e4 100644 --- a/packages/core/test/components/mapper/date.test.js +++ b/packages/core/test/components/mapper/date.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/fieldset.test.js b/packages/core/test/components/mapper/fieldset.test.js index 961bd8b7..5471e913 100644 --- a/packages/core/test/components/mapper/fieldset.test.js +++ b/packages/core/test/components/mapper/fieldset.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util, decorators } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/integer.test.js b/packages/core/test/components/mapper/integer.test.js index 75cd764a..aa91c0d1 100644 --- a/packages/core/test/components/mapper/integer.test.js +++ b/packages/core/test/components/mapper/integer.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/number.test.js b/packages/core/test/components/mapper/number.test.js index adae37cb..ca2e6458 100644 --- a/packages/core/test/components/mapper/number.test.js +++ b/packages/core/test/components/mapper/number.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { createElement as h } from 'react'; import { SchemaForm, getLocalizer, util } from '../../../src'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/components/mapper/select.test.js b/packages/core/test/components/mapper/select.test.js index 7b03912e..b30e4c08 100644 --- a/packages/core/test/components/mapper/select.test.js +++ b/packages/core/test/components/mapper/select.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { config } from 'react-transition-group'; import * as barebones from '@forml/decorator-barebones'; diff --git a/packages/core/test/general.test.js b/packages/core/test/general.test.js index f181b9d9..1169481a 100644 --- a/packages/core/test/general.test.js +++ b/packages/core/test/general.test.js @@ -1,5 +1,4 @@ import { render, fireEvent, waitFor } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import { SchemaForm, getLocalizer, util } from '../src'; import { createElement as h } from 'react'; diff --git a/packages/decorator-mui/src/__tests__/mui.test.js b/packages/decorator-mui/src/__tests__/mui.test.js index afe44150..8d4112b3 100644 --- a/packages/decorator-mui/src/__tests__/mui.test.js +++ b/packages/decorator-mui/src/__tests__/mui.test.js @@ -1,5 +1,3 @@ -import '@testing-library/jest-dom/extend-expect'; - import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { render } from '@testing-library/react';