diff --git a/.eslintrc.json b/.eslintrc.json index 27c826549..43002e254 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -136,8 +136,8 @@ "react/prop-types": 0, "simple-import-sort/imports": "error", "spaced-comment": "error", - "testing-library/await-async-query": "error", - "testing-library/no-await-sync-query": "error", + "testing-library/await-async-queries": "error", + "testing-library/no-await-sync-queries": "error", "testing-library/no-debugging-utils": "warn", "testing-library/no-dom-import": "off", "use-isnan": "error" diff --git a/package-lock.json b/package-lock.json index 98143711e..e90fa69c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,7 +68,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-sort-keys-fix": "^1.1.2", - "eslint-plugin-testing-library": "^5.11.1", + "eslint-plugin-testing-library": "^6.0.1", "git-revision-webpack-plugin": "^5.0.0", "jest": "^29.6.4", "jest-environment-jsdom": "^29.6.4", @@ -8696,9 +8696,9 @@ } }, "node_modules/eslint-plugin-testing-library": { - "version": "5.11.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.11.1.tgz", - "integrity": "sha512-5eX9e1Kc2PqVRed3taaLnAAqPZGEX75C+M/rXzUAI3wIg/ZxzUm1OVAwfe/O+vE+6YXOLetSe9g5GKD2ecXipw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-testing-library/-/eslint-plugin-testing-library-6.0.1.tgz", + "integrity": "sha512-CEYtjpcF3hAaQtYsTZqciR7s5z+T0LCMTwJeW+pz6kBnGtc866wAKmhaiK2Gsjc2jWNP7Gt6zhNr2DE1ZW4e+g==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.58.0" diff --git a/package.json b/package.json index 1f9d7594a..e751ae3b3 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-sort-keys-fix": "^1.1.2", - "eslint-plugin-testing-library": "^5.11.1", + "eslint-plugin-testing-library": "^6.0.1", "git-revision-webpack-plugin": "^5.0.0", "jest": "^29.6.4", "jest-environment-jsdom": "^29.6.4", diff --git a/src/routes/costModels/components/__snapshots__/rateTable.test.tsx.snap b/src/routes/costModels/components/__snapshots__/rateTable.test.tsx.snap index ebca6f9f4..0251cde18 100644 --- a/src/routes/costModels/components/__snapshots__/rateTable.test.tsx.snap +++ b/src/routes/costModels/components/__snapshots__/rateTable.test.tsx.snap @@ -24,53 +24,3 @@ exports[`rate-table sort by metric & measurement 1`] = ` , ] `; - -exports[`rate-table sort by metric & measurement 2`] = ` -[ - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"Node"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , -] -`; - -exports[`rate-table sort by metric & measurement 3`] = ` -[ - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"Node"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , -] -`; diff --git a/src/routes/costModels/components/rateTable.test.tsx b/src/routes/costModels/components/rateTable.test.tsx index 99b4292b9..1cadc0964 100644 --- a/src/routes/costModels/components/rateTable.test.tsx +++ b/src/routes/costModels/components/rateTable.test.tsx @@ -167,9 +167,11 @@ describe('rate-table', () => { render(); const metrics = screen.getAllByRole('cell', { name: /"value":"(CPU|Node)"/ }); expect(metrics).toMatchSnapshot(); - userEvent.click(screen.getByRole('button', { name: /metric/i })); - expect(metrics).toMatchSnapshot(); - userEvent.click(screen.getByRole('button', { name: /measurement/i })); - expect(metrics).toMatchSnapshot(); + userEvent.click(screen.getByRole('button', { name: /metric/i })).then(() => { + expect(metrics).toMatchSnapshot(); + }); + userEvent.click(screen.getByRole('button', { name: /measurement/i })).then(() => { + expect(metrics).toMatchSnapshot(); + }); }); }); diff --git a/src/routes/settings/costModels/components/__snapshots__/rateTable.test.tsx.snap b/src/routes/settings/costModels/components/__snapshots__/rateTable.test.tsx.snap index ebca6f9f4..0251cde18 100644 --- a/src/routes/settings/costModels/components/__snapshots__/rateTable.test.tsx.snap +++ b/src/routes/settings/costModels/components/__snapshots__/rateTable.test.tsx.snap @@ -24,53 +24,3 @@ exports[`rate-table sort by metric & measurement 1`] = ` , ] `; - -exports[`rate-table sort by metric & measurement 2`] = ` -[ - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"Node"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , -] -`; - -exports[`rate-table sort by metric & measurement 3`] = ` -[ - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"Node"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , - - {value, select, cpu {CPU} cluster {Cluster} memory {Memory} node {Node} persistent_volume_claims {Persistent volume claims} storage {Storage} other {}}{"value":"CPU"} - , -] -`; diff --git a/src/routes/settings/costModels/components/rateTable.test.tsx b/src/routes/settings/costModels/components/rateTable.test.tsx index 99b4292b9..1cadc0964 100644 --- a/src/routes/settings/costModels/components/rateTable.test.tsx +++ b/src/routes/settings/costModels/components/rateTable.test.tsx @@ -167,9 +167,11 @@ describe('rate-table', () => { render(); const metrics = screen.getAllByRole('cell', { name: /"value":"(CPU|Node)"/ }); expect(metrics).toMatchSnapshot(); - userEvent.click(screen.getByRole('button', { name: /metric/i })); - expect(metrics).toMatchSnapshot(); - userEvent.click(screen.getByRole('button', { name: /measurement/i })); - expect(metrics).toMatchSnapshot(); + userEvent.click(screen.getByRole('button', { name: /metric/i })).then(() => { + expect(metrics).toMatchSnapshot(); + }); + userEvent.click(screen.getByRole('button', { name: /measurement/i })).then(() => { + expect(metrics).toMatchSnapshot(); + }); }); });