You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2025/08/03 07:03:09 UTC
(superset) 01/01: fix(test): Add missing jest-dom import to fix CountryMap tests
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch pr-34524
in repository https://gitbox.apache.org/repos/asf/superset.git
commit acf3635500c72c0338eff5877e1c865013f01a41
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Sun Aug 3 00:02:37 2025 -0700
fix(test): Add missing jest-dom import to fix CountryMap tests
The tests were failing because jest-dom matchers (toHaveClass, toHaveAttribute,
toHaveStyle) were being used without importing @testing-library/jest-dom.
Also added CSS import to ensure styles are available during testing.
---
.../legacy-plugin-chart-country-map/test/CountryMap.test.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.js b/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.js
index 29bf789775..28c6e0901c 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.js
@@ -17,7 +17,9 @@
* under the License.
*/
+import '@testing-library/jest-dom';
import CountryMap from '../src/CountryMap';
+import '../src/CountryMap.css';
describe('CountryMap', () => {
let container;
@@ -84,8 +86,10 @@ describe('CountryMap', () => {
const tooltip = container.querySelector('.tooltip');
expect(tooltip).toBeTruthy();
- // Check if tooltip has position absolute
- const computedStyle = window.getComputedStyle(tooltip);
- expect(computedStyle.position).toBe('absolute');
+ // Check if tooltip has the correct class
+ expect(tooltip).toHaveClass('tooltip');
+
+ // Check if tooltip has opacity 0 initially
+ expect(tooltip).toHaveStyle({ opacity: '0' });
});
});