From 5fc3aa551c84badfa853bd2e65dc11ad3c454a5e Mon Sep 17 00:00:00 2001 From: Pascal Opitz Date: Wed, 27 Mar 2024 21:05:29 +1030 Subject: [PATCH] Fix tests --- package-lock.json | 96 ++++++++++++++++------------------ package.json | 2 +- setupTests.js | 8 ++- src/ui/components/AlbumArt.jsx | 2 +- 4 files changed, 55 insertions(+), 53 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4a01eb8..76d42e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@babel/plugin-transform-react-jsx": "^7.22.15", "@babel/plugin-transform-runtime": "^7.17.0", "@babel/preset-env": "^7.16.11", - "@wojtekmaj/enzyme-adapter-react-17": "^0.6.3", + "@cfaester/enzyme-adapter-react-18": "^0.7.1", "babel-loader": "^8.2.3", "babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-transform-react-jsx": "^6.24.1", @@ -1875,6 +1875,51 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@cfaester/enzyme-adapter-react-18": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@cfaester/enzyme-adapter-react-18/-/enzyme-adapter-react-18-0.7.1.tgz", + "integrity": "sha512-Z3m1qNSlQdrcXdnPSGOAysLdgJFSowu7sbK1cHRcWXuZGS3WOTFOS0kIXbWMa1FnkEbswlIU6KgS+8qKgM6Kqw==", + "dev": true, + "dependencies": { + "enzyme-shallow-equal": "^1.0.0", + "react-is": "^18.2.0", + "react-test-renderer": "^18.2.0" + }, + "peerDependencies": { + "enzyme": "^3.11.0", + "react": "^18.2.0", + "react-dom": "^18.2.0" + } + }, + "node_modules/@cfaester/enzyme-adapter-react-18/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/@cfaester/enzyme-adapter-react-18/node_modules/react-test-renderer": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz", + "integrity": "sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==", + "dev": true, + "dependencies": { + "react-is": "^18.2.0", + "react-shallow-renderer": "^16.15.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/@cfaester/enzyme-adapter-react-18/node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + } + }, "node_modules/@develar/schema-utils": { "version": "2.6.5", "resolved": "https://registry.npmjs.org/@develar/schema-utils/-/schema-utils-2.6.5.tgz", @@ -3484,40 +3529,6 @@ } } }, - "node_modules/@wojtekmaj/enzyme-adapter-react-17": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-react-17/-/enzyme-adapter-react-17-0.6.7.tgz", - "integrity": "sha512-B+byiwi/T1bx5hcj9wc0fUL5Hlb5giSXJzcnEfJVl2j6dGV2NJfcxDBYX0WWwIxlzNiFz8kAvlkFWI2y/nscZQ==", - "dev": true, - "dependencies": { - "@wojtekmaj/enzyme-adapter-utils": "^0.1.4", - "enzyme-shallow-equal": "^1.0.0", - "has": "^1.0.0", - "prop-types": "^15.7.0", - "react-is": "^17.0.0", - "react-test-renderer": "^17.0.0" - }, - "peerDependencies": { - "enzyme": "^3.0.0", - "react": "^17.0.0-0", - "react-dom": "^17.0.0-0" - } - }, - "node_modules/@wojtekmaj/enzyme-adapter-utils": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-utils/-/enzyme-adapter-utils-0.1.4.tgz", - "integrity": "sha512-ARGIQSIIv3oBia1m5Ihn1VU0FGmft6KPe39SBKTb8p7LSXO23YI4kNtc4M/cKoIY7P+IYdrZcgMObvedyjoSQA==", - "dev": true, - "dependencies": { - "function.prototype.name": "^1.1.0", - "has": "^1.0.0", - "object.fromentries": "^2.0.0", - "prop-types": "^15.7.0" - }, - "peerDependencies": { - "react": "^17.0.0-0" - } - }, "node_modules/@xmldom/xmldom": { "version": "0.8.10", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", @@ -12094,21 +12105,6 @@ "react": "^16.0.0 || ^17.0.0 || ^18.0.0" } }, - "node_modules/react-test-renderer": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-17.0.2.tgz", - "integrity": "sha512-yaQ9cB89c17PUb0x6UfWRs7kQCorVdHlutU1boVPEsB8IDZH6n9tHxMacc3y0JoXOJUsZb/t/Mb8FUWMKaM7iQ==", - "dev": true, - "dependencies": { - "object-assign": "^4.1.1", - "react-is": "^17.0.2", - "react-shallow-renderer": "^16.13.1", - "scheduler": "^0.20.2" - }, - "peerDependencies": { - "react": "17.0.2" - } - }, "node_modules/read-config-file": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-6.2.0.tgz", diff --git a/package.json b/package.json index bd3df87..8d7fe56 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "@babel/plugin-transform-react-jsx": "^7.22.15", "@babel/plugin-transform-runtime": "^7.17.0", "@babel/preset-env": "^7.16.11", - "@wojtekmaj/enzyme-adapter-react-17": "^0.6.3", + "@cfaester/enzyme-adapter-react-18": "^0.7.1", "babel-loader": "^8.2.3", "babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-transform-react-jsx": "^6.24.1", diff --git a/setupTests.js b/setupTests.js index f5cbebc..16bbf8a 100644 --- a/setupTests.js +++ b/setupTests.js @@ -1,5 +1,11 @@ import { configure } from 'enzyme'; -import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; +import Adapter from '@cfaester/enzyme-adapter-react-18'; +import util from 'util'; + +Object.defineProperty(global, 'TextEncoder', { + value: util.TextEncoder, +}); + configure({ adapter: new Adapter() }); window.QueueActions = {}; diff --git a/src/ui/components/AlbumArt.jsx b/src/ui/components/AlbumArt.jsx index 7c82674..1fd98c7 100644 --- a/src/ui/components/AlbumArt.jsx +++ b/src/ui/components/AlbumArt.jsx @@ -227,7 +227,7 @@ export const AlbumArt = (props) => { data-loading={loading} data-loaded={loaded} data-failed={failed} - data-serviceId={serviceId} + data-serviceid={serviceId} data-src-computed={src} data-src-prop={propsSrc} />