diff --git a/jest.config.ts b/jest.config.ts index dbbf912..c448615 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -49,7 +49,7 @@ export default { // dependencyExtractor: undefined, // Make calling deprecated APIs throw helpful error messages - // errorOnDeprecated: false, + errorOnDeprecated: true, // The default configuration for fake timers // fakeTimers: { diff --git a/package-lock.json b/package-lock.json index 517a26e..ccd0c12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@statisticsfinland/pxvisualizer", - "version": "1.4.7", + "version": "1.4.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@statisticsfinland/pxvisualizer", - "version": "1.4.7", + "version": "1.4.11", "license": "Apache-2.0", "dependencies": { "decimal.js": "^10.5.0", @@ -24,22 +24,16 @@ "@storybook/react-webpack5": "^10.3.5", "@testing-library/dom": "^10.4.0", "@testing-library/react": "^16.3.0", - "@types/file-saver": "^2.0.7", "@types/jest": "^30.0.0", - "@types/papaparse": "^5.3.15", "@types/react": "^19.1.0", - "@types/styled-components": "^5.1.34", - "@types/uuid": "^10.0.0", "babel-loader": "^10.0.0", "clean-publish": "^6.0.5", - "decimal.js": "^10.5.0", "jest": "^30.2.0", "jest-environment-jsdom": "^30.2.0", "jest-junit": "^17.0.0", "jest-sonar-reporter": "^2.0.0", "jest-styled-components": "^7.2.0", "microbundle": "^0.15.1", - "papaparse": "^5.5.2", "react": "^19.1.0", "react-dom": "^19.1.0", "semver": "^7.7.0", @@ -48,8 +42,7 @@ "ts-jest": "^29.4.9", "ts-node": "^10.9.2", "typescript": "^5.8.3", - "uuid": "^14.0.0", - "yaml": "^1.10.3" + "uuid": "^14.0.0" }, "peerDependencies": { "react": "^18.2.0 || ^19.1.0", @@ -100,9 +93,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", - "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", "dev": true, "license": "MIT", "engines": { @@ -110,21 +103,21 @@ } }, "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -181,14 +174,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -434,9 +427,9 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", "dev": true, "license": "MIT", "engines": { @@ -459,14 +452,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.29.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", - "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0" + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -2736,9 +2729,9 @@ } }, "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", - "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.0.tgz", + "integrity": "sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==", "dev": true, "license": "MIT", "dependencies": { @@ -4399,26 +4392,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/file-saver": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.7.tgz", - "integrity": "sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/hoist-non-react-statics": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.7.tgz", - "integrity": "sha512-PQTyIulDkIDro8P+IHbKCsw7U2xxBYflVzW/FgWdCAePD9xGSidgA76/GeJ6lBKoblyhf9pBY763gbrN+1dI8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "hoist-non-react-statics": "^3.3.0" - }, - "peerDependencies": { - "@types/react": "*" - } - }, "node_modules/@types/html-minifier-terser": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", @@ -4535,16 +4508,6 @@ "undici-types": "~7.19.0" } }, - "node_modules/@types/papaparse": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/@types/papaparse/-/papaparse-5.5.2.tgz", - "integrity": "sha512-gFnFp/JMzLHCwRf7tQHrNnfhN4eYBVYYI897CGX4MY1tzY9l2aLkVyx2IlKZ/SAqDbB3I1AOZW5gTMGGsqWliA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/parse-json": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", @@ -4586,18 +4549,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/styled-components": { - "version": "5.1.36", - "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.36.tgz", - "integrity": "sha512-pGMRNY5G2rNDKEv2DOiFYa7Ft1r0jrhmgBwHhOMzPTgCjO76bCot0/4uEfqj7K0Jf1KdQmDtAuaDk9EAs9foSw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/hoist-non-react-statics": "*", - "@types/react": "*", - "csstype": "^3.2.2" - } - }, "node_modules/@types/tough-cookie": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", @@ -4605,13 +4556,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/yargs": { "version": "17.0.35", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz", @@ -5800,9 +5744,9 @@ "license": "ISC" }, "node_modules/brace-expansion": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz", - "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz", + "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==", "dev": true, "license": "MIT", "dependencies": { @@ -6764,7 +6708,6 @@ "version": "10.6.0", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", - "dev": true, "license": "MIT" }, "node_modules/dedent": { @@ -7514,9 +7457,9 @@ "license": "MIT" }, "node_modules/fast-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz", - "integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz", + "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==", "dev": true, "funding": [ { @@ -8267,16 +8210,6 @@ "react": ">=16.8.0" } }, - "node_modules/hoist-non-react-statics": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", - "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "react-is": "^16.7.0" - } - }, "node_modules/html-encoding-sniffer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", @@ -10234,10 +10167,20 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -10942,9 +10885,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", + "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", "dev": true, "funding": [ { @@ -11300,13 +11243,6 @@ "dev": true, "license": "BlueOak-1.0.0" }, - "node_modules/papaparse": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.5.3.tgz", - "integrity": "sha512-5QvjGxYVjxO59MGU2lHVYpRWBBtKHnlIAcSe1uNFCkkptUh63NFRj0FJQm7nR67puEruUci/ZkjmEFrjCAyP4A==", - "dev": true, - "license": "MIT" - }, "node_modules/param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", @@ -11578,9 +11514,9 @@ } }, "node_modules/postcss": { - "version": "8.5.12", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.12.tgz", - "integrity": "sha512-W62t/Se6rA0Az3DfCL0AqJwXuKwBeYg6nOaIgzP+xZ7N5BFCI7DYi1qs6ygUYT6rvfi6t9k65UMLJC+PHZpDAA==", + "version": "8.5.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.23.tgz", + "integrity": "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==", "dev": true, "funding": [ { @@ -11598,7 +11534,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -12405,13 +12341,6 @@ "react": "^19.2.5" } }, - "node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true, - "license": "MIT" - }, "node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -12881,17 +12810,17 @@ } }, "node_modules/rollup-plugin-typescript2": { - "version": "0.32.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.32.1.tgz", - "integrity": "sha512-RanO8bp1WbeMv0bVlgcbsFNCn+Y3rX7wF97SQLDxf0fMLsg0B/QFF005t4AsGUcDgF3aKJHoqt4JF2xVaABeKw==", + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.37.0.tgz", + "integrity": "sha512-S1r/4Ufi13Yg/chPlh4iSHWq2Zs/sIAodW5SKUoCQfy/DEQhkS2XRFEtv+NRq3iBO4WHHfqKtDPOC5lJTYm7OQ==", "dev": true, "license": "MIT", "dependencies": { "@rollup/pluginutils": "^4.1.2", "find-cache-dir": "^3.3.2", "fs-extra": "^10.0.0", - "resolve": "^1.20.0", - "tslib": "^2.4.0" + "semver": "^7.5.4", + "tslib": "^2.6.2" }, "peerDependencies": { "rollup": ">=1.26.3", @@ -12913,9 +12842,9 @@ } }, "node_modules/rollup-plugin-typescript2/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "dev": true, "license": "MIT", "engines": { @@ -13878,9 +13807,9 @@ } }, "node_modules/svgo": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.2.tgz", - "integrity": "sha512-TyzE4NVGLUFy+H/Uy4N6c3G0HEeprsVfge6Lmq+0FdQQ/zqoVYB62IsBZORsiL+o96s6ff/V6/3UQo/C0cgCAA==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.3.tgz", + "integrity": "sha512-5EZD0pafXX6PphdwOGCiVLDSaV1xyuQao2blHajHLsPxr07q4mmEjdtXEWgG07ae2mIz8Ex2CDXNCTiXhy3Khw==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 09ecda1..240d12f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@statisticsfinland/pxvisualizer", - "version": "1.4.8", + "version": "1.4.11", "description": "Component library for visualizing PxGraf data", "main": "./dist/pxv.cjs", "jestSonar": { @@ -33,9 +33,9 @@ "test:watch": "jest --watchAll=true", "build": "microbundle --globals highcharts/modules/accessibility.js=highchartsAccessibility,highcharts/modules/exporting.js=highchartsExporting,highcharts/modules/export-data.js=highchartsExportData,highcharts/modules/offline-exporting.js=highchartsOfflineExporting,decimal.js=Decimal,highcharts/modules/pattern-fill.js=patternFill", "dev": "microbundle watch", - "storybook": "set NODE_OPTIONS=--openssl-legacy-provider && storybook dev -p 6006", + "storybook": "storybook dev -p 6006", "storybook_legacy": "storybook dev -p 6006", - "build-storybook": "set NODE_OPTIONS=--openssl-legacy-provider && storybook build", + "build-storybook": "storybook build", "prepublishOnly": "npm run build", "version-helper": "node .github/scripts/version-helper.js" }, @@ -55,22 +55,16 @@ "@storybook/react-webpack5": "^10.3.5", "@testing-library/dom": "^10.4.0", "@testing-library/react": "^16.3.0", - "@types/file-saver": "^2.0.7", "@types/jest": "^30.0.0", - "@types/papaparse": "^5.3.15", "@types/react": "^19.1.0", - "@types/styled-components": "^5.1.34", - "@types/uuid": "^10.0.0", "babel-loader": "^10.0.0", "clean-publish": "^6.0.5", - "decimal.js": "^10.5.0", "jest": "^30.2.0", "jest-environment-jsdom": "^30.2.0", "jest-junit": "^17.0.0", "jest-sonar-reporter": "^2.0.0", "jest-styled-components": "^7.2.0", "microbundle": "^0.15.1", - "papaparse": "^5.5.2", "react": "^19.1.0", "react-dom": "^19.1.0", "semver": "^7.7.0", @@ -79,8 +73,7 @@ "ts-jest": "^29.4.9", "ts-node": "^10.9.2", "typescript": "^5.8.3", - "uuid": "^14.0.0", - "yaml": "^1.10.3" + "uuid": "^14.0.0" }, "dependencies": { "decimal.js": "^10.5.0", @@ -98,11 +91,13 @@ "visualization" ], "overrides": { - "brace-expansion": "^2.0.3", + "brace-expansion": "^2.1.3", + "fast-uri": "3.1.5", "postcss": "^8.5.10", "serialize-javascript": "^7.0.4", "rollup-plugin-typescript2": { - "picomatch": "2.3.1" + ".": "0.37.0", + "picomatch": "2.3.2" } } } diff --git a/src/core/chartOptions/Utility/formatters.test.ts b/src/core/chartOptions/Utility/formatters.test.ts index 405c1f2..39c00de 100644 --- a/src/core/chartOptions/Utility/formatters.test.ts +++ b/src/core/chartOptions/Utility/formatters.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { DataLabelsOptions, Point, Tooltip } from "highcharts"; import { formatLocale, getDataFormattedForChartType, getDataLabelFormatterFunction, getLineChartToolTipFormatterFunction, getToolTipFormatterFunction, parseScreenReaderFriendlyTimePeriods, shortenStringValue, getFormattedLastUpdatedText } from "./formatters"; import { combinationValuesLinechartViewFixture, multiselectableLineChartViewFixture, simpleQuarterLinechartViewFixture } from "./fixtures/linechartViews"; @@ -56,68 +57,19 @@ describe('shortenStringValue tests', () => { }); describe('parseScreenReaderFriendlyTimePeriods', () => { - it('Should return parsed month string', () => { - const testValue = '2000M1'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'fi'); - const expected = '2000 tammikuu'; - expect(result).toEqual(expected); - }); - - it('Should return parsed month string localized', () => { - const testValue = '2000M1'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'en'); - const expected = '2000 January'; - expect(result).toEqual(expected); - }); - - it('Should return parsed quarter string', () => { - const testValue = '2000Q1'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'fi'); - const expected = '2000 1. vuosineljännes'; - expect(result).toEqual(expected); - }); - - it('Should return parsed quarter string localized en first', () => { - const testValue = '2000Q1'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'en'); - const expected = '2000 1st. quarter'; - expect(result).toEqual(expected); - }); - it('Should return parsed quarter string localized en second', () => { - const testValue = '2000Q2'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'en'); - const expected = '2000 2nd. quarter'; - expect(result).toEqual(expected); - }); - it('Should return parsed quarter string localized en third', () => { - const testValue = '2000Q3'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'en'); - const expected = '2000 3rd. quarter'; - expect(result).toEqual(expected); - }); - it('Should return parsed quarter string localized en fourth', () => { - const testValue = '2000Q4'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'en'); - const expected = '2000 4th. quarter'; - expect(result).toEqual(expected); - }); - it('Should not parse if value doesnt match', () => { - const testValue = 'foobar'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'fi'); - const expected = 'foobar'; - expect(result).toEqual(expected); - }); - it('Should return parsed preliminary quarter string', () => { - const testValue = '2000Q2*'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'en'); - const expected = '2000 2nd. quarter'; - expect(result).toEqual(expected); - }); - it('Should return parsed preliminary month string', () => { - const testValue = '2000M2*'; - const result = parseScreenReaderFriendlyTimePeriods(testValue, 'en'); - const expected = '2000 February'; - expect(result).toEqual(expected); + it.each([ + { testValue: '2000M1', locale: 'fi', expected: '2000 tammikuu' }, + { testValue: '2000M1', locale: 'en', expected: '2000 January' }, + { testValue: '2000Q1', locale: 'fi', expected: '2000 1. vuosineljännes' }, + { testValue: '2000Q1', locale: 'en', expected: '2000 1st. quarter' }, + { testValue: '2000Q2', locale: 'en', expected: '2000 2nd. quarter' }, + { testValue: '2000Q3', locale: 'en', expected: '2000 3rd. quarter' }, + { testValue: '2000Q4', locale: 'en', expected: '2000 4th. quarter' }, + { testValue: 'foobar', locale: 'fi', expected: 'foobar' }, + { testValue: '2000Q2*', locale: 'en', expected: '2000 2nd. quarter' }, + { testValue: '2000M2*', locale: 'en', expected: '2000 February' } + ])('parses $testValue for $locale', ({ testValue, locale, expected }) => { + expect(parseScreenReaderFriendlyTimePeriods(testValue, locale)).toBe(expected); }); }); diff --git a/src/core/chartOptions/Utility/ordinalIntervals.test.ts b/src/core/chartOptions/Utility/ordinalIntervals.test.ts index e9851ea..975c344 100644 --- a/src/core/chartOptions/Utility/ordinalIntervals.test.ts +++ b/src/core/chartOptions/Utility/ordinalIntervals.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { ETimeVariableInterval, EVisualizationType } from "../../types"; import { ESeriesType, View } from "../../types/view"; import { getOrdinalOptions } from "./ordinalIntervals"; diff --git a/src/core/chartOptions/Utility/patternFill.test.ts b/src/core/chartOptions/Utility/patternFill.test.ts index befc094..9a13d99 100644 --- a/src/core/chartOptions/Utility/patternFill.test.ts +++ b/src/core/chartOptions/Utility/patternFill.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { buildPatternObject } from "./patternFill"; import { defaultColors } from "../../highcharts/defaultColors"; import { defaultFillPatterns } from "../../highcharts/fillPatterns"; diff --git a/src/core/chartOptions/Utility/seriesDataBuilder.test.ts b/src/core/chartOptions/Utility/seriesDataBuilder.test.ts index aaa24ef..42c8880 100644 --- a/src/core/chartOptions/Utility/seriesDataBuilder.test.ts +++ b/src/core/chartOptions/Utility/seriesDataBuilder.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { buildLineChartSeries, buildBarChartSeries, buildColumnChartSeries } from "./seriesDataBuilder"; import { simpleGroupHorizontalBarchartViewFixture } from "./fixtures/grouphorizontalbarchartViews"; import { simpleQuarterLinechartViewFixture } from "./fixtures/linechartViews"; diff --git a/src/core/chartOptions/Utility/tickPositionerUtilities.test.ts b/src/core/chartOptions/Utility/tickPositionerUtilities.test.ts index a7040e1..6f9b280 100644 --- a/src/core/chartOptions/Utility/tickPositionerUtilities.test.ts +++ b/src/core/chartOptions/Utility/tickPositionerUtilities.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import Decimal from "decimal.js"; import { buildLinearAxisTickPositioner, getDivisibilityScore, getInterval, linearAxisIntervalStepFunction } from "./tickPositionerUtilities"; diff --git a/src/core/chartOptions/Utility/tickPositioners.test.ts b/src/core/chartOptions/Utility/tickPositioners.test.ts index 5cad1a3..6734f18 100644 --- a/src/core/chartOptions/Utility/tickPositioners.test.ts +++ b/src/core/chartOptions/Utility/tickPositioners.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { Axis } from "highcharts"; import { getLinearAxisTickPositionerFunction, getLinearSumAxisTickPositionerFunction, getOrdinalAxisTickPositionerFunction, getQuarterlySeriesTickPositionerFunction } from "./tickPositioners"; diff --git a/src/core/chartOptions/Utility/timeIntervals.test.ts b/src/core/chartOptions/Utility/timeIntervals.test.ts index ea4899f..446b50f 100644 --- a/src/core/chartOptions/Utility/timeIntervals.test.ts +++ b/src/core/chartOptions/Utility/timeIntervals.test.ts @@ -1,4 +1,5 @@ -import { ETimeVariableInterval } from "../../types"; +import { describe, expect, it } from '@jest/globals'; +import { ETimeVariableInterval } from "../../types"; import { EVisualizationType } from "../../types/queryVisualizationResponse"; import { ESeriesType, View } from "../../types/view"; import { getTimeSeriesOptions, getXAxisOptions } from "./timeIntervals"; @@ -12,7 +13,7 @@ describe('getTimeSeriesOptions tests', () => { }); it('Should return undefined', () => { const result = getTimeSeriesOptions(ETimeVariableInterval.Week, TIME); - expect(result).toEqual(undefined); + expect(result).toBeUndefined(); }); it('Should return correct options when interval is month', () => { const result = getTimeSeriesOptions(ETimeVariableInterval.Month, TIME); @@ -23,11 +24,11 @@ describe('getTimeSeriesOptions tests', () => { }); it('Should return undefined', () => { const result = getTimeSeriesOptions(ETimeVariableInterval.Quarter, TIME); - expect(result).toEqual(undefined); + expect(result).toBeUndefined(); }); it('Should return undefined', () => { const result = getTimeSeriesOptions(ETimeVariableInterval.HalfYear, TIME); - expect(result).toEqual(undefined); + expect(result).toBeUndefined(); }); it('Should return correct options when interval is year', () => { const result = getTimeSeriesOptions(ETimeVariableInterval.Year, TIME); diff --git a/src/core/chartOptions/chartOptions.ts b/src/core/chartOptions/chartOptions.ts index 7c81414..b356fc1 100644 --- a/src/core/chartOptions/chartOptions.ts +++ b/src/core/chartOptions/chartOptions.ts @@ -37,7 +37,12 @@ export const commonChartOptions = (view: View, locale: string, options?: IChartO tooltip: { formatter: getToolTipFormatterFunction(view, locale) }, - yAxis: [commonYAxisOptions] + yAxis: [commonYAxisOptions], + lang: { + accessibility: { + chartContainerLabel: view.header[locale] // Reads the title of the chart but omits the 'Highcharts interactive chart' part which is read by default and is redundant in our case + } + } }; } diff --git a/src/core/conversion/pxGrafDataConverter.test.ts b/src/core/conversion/pxGrafDataConverter.test.ts index cbef156..cfa4214 100644 --- a/src/core/conversion/pxGrafDataConverter.test.ts +++ b/src/core/conversion/pxGrafDataConverter.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { convertPxGraphDataToChartOptions } from "./pxGrafDataConverter"; import { GROUP_HORIZONTAL_BAR_CHART_WITH_SELECTABLES } from "./fixtures/groupHorizontalBarChart"; import { GROUP_VERTICAL_BAR_CHART_WITH_SELECTABLES_PIVOTED } from "./fixtures/groupVerticalBarChart"; diff --git a/src/core/conversion/seriesBuilderUtilities.test.ts b/src/core/conversion/seriesBuilderUtilities.test.ts index 271a533..fc1dd47 100644 --- a/src/core/conversion/seriesBuilderUtilities.test.ts +++ b/src/core/conversion/seriesBuilderUtilities.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { EVariableType } from "../types"; import { IVariableMeta } from "../types/queryVisualizationResponse"; import { TVariableSelections } from "../types/variableSelections"; diff --git a/src/core/conversion/translations/translationManager.test.ts b/src/core/conversion/translations/translationManager.test.ts index 2832461..0feb323 100644 --- a/src/core/conversion/translations/translationManager.test.ts +++ b/src/core/conversion/translations/translationManager.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { Translations, ArrayTranslations, GetAllLanguages, TTranslationPackage, AddTranslations } from '../translations' const mockTranslationPackage: TTranslationPackage = { diff --git a/src/core/conversion/utilityFunctions.test.ts b/src/core/conversion/utilityFunctions.test.ts index d490b16..005a428 100644 --- a/src/core/conversion/utilityFunctions.test.ts +++ b/src/core/conversion/utilityFunctions.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { cartesianProduct, compareScalarArrays } from './utilityFunctions'; describe('cartesian function', () => { diff --git a/src/core/conversion/viewUtils.test.ts b/src/core/conversion/viewUtils.test.ts index eb7fc66..d7938d2 100644 --- a/src/core/conversion/viewUtils.test.ts +++ b/src/core/conversion/viewUtils.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { ETimeVariableInterval, EVariableType, EVisualizationType, IContentComponent, IQueryVisualizationResponse, IVariableMeta, IVariableValueMeta, TMultiLanguageString } from '../types/queryVisualizationResponse'; import { TVariableSelections } from '../types/variableSelections'; import { ESeriesType, IDataSeries, View } from '../types/view'; @@ -219,20 +220,20 @@ describe('series metadata', () => { // Value 1 in selection const selectedValueCodes1: TVariableSelections = { [contentVariable.code]: [contentVariableValue1.code] }; const { series: rows1 } = buildSeries(pxGrafResponse, selectedValueCodes1); - expect(rows1.length).toEqual(1); + expect(rows1).toHaveLength(1); const { series: series1 } = rows1[0]; - expect(series1.length).toEqual(1); + expect(series1).toHaveLength(1); expect(series1[0].precision).toBe(contentVariableValue1.contentComponent?.numberOfDecimals); // Value 2 in selection const selectedValueCodes2: TVariableSelections = { [contentVariable.code]: [contentVariableValue2.code] }; const { series: rows2 } = buildSeries(pxGrafResponse, selectedValueCodes2); - expect(rows2.length).toEqual(1); + expect(rows2).toHaveLength(1); const { series: series2 } = rows2[0]; - expect(series2.length).toEqual(1); + expect(series2).toHaveLength(1); expect(series2[0].precision).toBe(contentVariableValue2.contentComponent?.numberOfDecimals); }); @@ -259,10 +260,10 @@ describe('series metadata', () => { const selectedValueCodes1: TVariableSelections = {}; const { series: rows } = buildSeries(pxGrafResponse, selectedValueCodes1); - expect(rows.length).toEqual(1); + expect(rows).toHaveLength(1); const { series } = rows[0]; - expect(series.length).toEqual(pxGrafResponse.data.length); + expect(series).toHaveLength(pxGrafResponse.data.length); expect(series[0].precision).toEqual(contentVariable.values[0].contentComponent?.numberOfDecimals); }); @@ -290,10 +291,10 @@ describe('series metadata', () => { const selectedValueCodes1: TVariableSelections = {}; const { series: rows } = buildSeries(pxGrafResponse, selectedValueCodes1); - expect(rows.length).toEqual(1); + expect(rows).toHaveLength(1); const { series } = rows[0]; - expect(series.length).toEqual(pxGrafResponse.data.length); + expect(series).toHaveLength(pxGrafResponse.data.length); expect(series[0].precision).toEqual(contentVariable.values[0].contentComponent?.numberOfDecimals); @@ -324,16 +325,16 @@ describe('series metadata', () => { const selectedValueCodes1: TVariableSelections = {}; const { series: rows } = buildSeries(pxGrafResponse, selectedValueCodes1); - expect(rows.length).toEqual(2); + expect(rows).toHaveLength(2); // Row 1 const { series: series0 } = rows[0]; - expect(series0.length).toEqual(1); + expect(series0).toHaveLength(1); expect(series0[0].precision).toEqual(contentVariable.values[0].contentComponent?.numberOfDecimals); // Row 2 const { series: series1 } = rows[1]; - expect(series1.length).toEqual(1); + expect(series1).toHaveLength(1); expect(series1[0].precision).toEqual(contentVariable.values[1].contentComponent?.numberOfDecimals); }); diff --git a/src/core/highcharts/drawChart.test.tsx b/src/core/highcharts/drawChart.test.tsx index 0564399..7831e03 100644 --- a/src/core/highcharts/drawChart.test.tsx +++ b/src/core/highcharts/drawChart.test.tsx @@ -1,3 +1,4 @@ +import { beforeEach, describe, expect, it, jest } from '@jest/globals'; import * as Highcharts from "highcharts"; import { drawChart } from "./drawChart"; import { GROUP_VERTICAL_BAR_CHART_CHART_FIXTURE } from "../../react/components/chart/testFixtures/pxGrafResponses"; diff --git a/src/core/tables/__snapshots__/htmlTable.test.ts.snap b/src/core/tables/__snapshots__/htmlTable.test.ts.snap index 97cdc47..c7221f1 100644 --- a/src/core/tables/__snapshots__/htmlTable.test.ts.snap +++ b/src/core/tables/__snapshots__/htmlTable.test.ts.snap @@ -1,3600 +1,3600 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`Html table render tests should match snapshot: Table with column variables only 1`] = ` -" -  - Adoptiot 1987-1989 muuttujina Syntymävaltio, Ikä - 

 -  -  -  -  - 1987 -  -  - 1988 -  -  - 1989 -  -  -  -  - Suomi -  -  - Espanja -  -  - Italia -  -  - Suomi -  -  - Espanja -  -  - Italia -  -  - Suomi -  -  - Espanja -  -  - Italia -  -  -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  - 0 - 17 -  -  - 18 - -  -  -  -  -  -  - 242 -  -  - 62 -  -  - 0 -  -  - 0 -  -  - 0 -  -  - 0 -  -  - 240 -  -  - 85 -  -  - 0 -  -  - 0 -  -  - 0 -  -  - 0 -  -  - 216 -  -  - 91 -  -  - 0 -  -  - 0 -  -  - 0 -  -  - 0 -  -  -  -  -  - Yksikkö: lukumäärä -  -  - 
 - Lähde: PxVisualizer-fi - 
 -" +
+

+ Adoptiot 1987-1989 muuttujina Syntymävaltio, Ikä +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 1987 + + 1988 + + 1989 +
+ Suomi + + Espanja + + Italia + + Suomi + + Espanja + + Italia + + Suomi + + Espanja + + Italia +
+ 0 - 17 + + 18 - + + 0 - 17 + + 18 - + + 0 - 17 + + 18 - + + 0 - 17 + + 18 - + + 0 - 17 + + 18 - + + 0 - 17 + + 18 - + + 0 - 17 + + 18 - + + 0 - 17 + + 18 - + + 0 - 17 + + 18 - +
+ 242 + + 62 + + 0 + + 0 + + 0 + + 0 + + 240 + + 85 + + 0 + + 0 + + 0 + + 0 + + 216 + + 91 + + 0 + + 0 + + 0 + + 0 +
+ + Yksikkö: lukumäärä + + +
+ Lähde: PxVisualizer-fi +
+
`; exports[`Html table render tests should match snapshot: Table with invalid missing data should render error message 1`] = ` -" - 

 - Kuviota ei voitu muodostaa - 

 -" +
+

+ Kuviota ei voitu muodostaa +

+
`; exports[`Html table render tests should match snapshot: Table with missing data and selectable values 1`] = ` -" -  - Neliöhinta (EUR/m2), Helsinki 2020Q1-2023Q2* muuttujina Talotyyppi, Huoneluku - 
 - Rivitalot | Kaksiot - 

 -  -  -  -  - 2020Q1 -  -  - 2020Q2 -  -  - 2020Q3 -  -  - 2020Q4 -  -  - 2021Q1 -  -  - 2021Q2 -  -  - 2021Q3 -  -  - 2021Q4 -  -  - 2022Q1 -  -  - 2022Q2 -  -  - 2022Q3 -  -  - 2022Q4 -  -  - 2023Q1* -  -  - 2023Q2* -  -  -  -  -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  - Tieto puuttuu -  -  -  -  -  - Yksikkö: Eur / m2 -  -  - 
 - Lähde: PxVisualizer-fi - 
 -" +
+

+ Neliöhinta (EUR/m2), Helsinki 2020Q1-2023Q2* muuttujina Talotyyppi, Huoneluku +
+ Rivitalot | Kaksiot +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 2020Q1 + + 2020Q2 + + 2020Q3 + + 2020Q4 + + 2021Q1 + + 2021Q2 + + 2021Q3 + + 2021Q4 + + 2022Q1 + + 2022Q2 + + 2022Q3 + + 2022Q4 + + 2023Q1* + + 2023Q2* +
+ Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu + + Tieto puuttuu +
+ + Yksikkö: Eur / m2 + + +
+ Lähde: PxVisualizer-fi +
+
`; exports[`Html table render tests should match snapshot: Table with only one cell 1`] = ` -" -  - Lukumäärä, Vantaa, Yksiöt, Vapaarahoitteinen 2022Q4 - 

 -  -  -  -  - 2 548 -  -  -  -  -  - Yksikkö: lukumäärä -  -  - 
 - Lähde: PxVisualizer-fi - 
 -" +
+

+ Lukumäärä, Vantaa, Yksiöt, Vapaarahoitteinen 2022Q4 +

+ + + + + + +
+ 2 548 +
+ + Yksikkö: lukumäärä + + +
+ Lähde: PxVisualizer-fi +
+
`; exports[`Html table render tests should match snapshot: Table with row and column variables 1`] = ` -" -  - Tiedot 2022Q1-2022Q4 muuttujina Tiedot, Alue, Huoneluku, Rahoitusmuoto - 

 -  -  -  -  -  - Yksiöt -  -  - Kaksiot -  -  -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  -  -  -  -  - Helsinki -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 13 021 -  -  - 26,64 -  -  - 10 080 -  -  - 20,22 -  -  -  -  - ARA -  -  - 3 810 -  -  - 15,90 -  -  - 6 176 -  -  - 13,74 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 11 231 -  -  - 26,82 -  -  - 9 326 -  -  - 20,45 -  -  -  -  - ARA -  -  - 3 552 -  -  - 15,97 -  -  - 5 749 -  -  - 13,78 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 10 269 -  -  - 26,93 -  -  - 8 907 -  -  - 20,59 -  -  -  -  - ARA -  -  - 3 249 -  -  - 15,99 -  -  - 5 280 -  -  - 13,79 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 10 272 -  -  - 26,93 -  -  - 8 805 -  -  - 20,66 -  -  -  -  - ARA -  -  - 3 323 -  -  - 16,08 -  -  - 5 265 -  -  - 13,80 -  -  -  -  - Vantaa -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 3 043 -  -  - 23,48 -  -  - 5 261 -  -  - 17,62 -  -  -  -  - ARA -  -  - 941 -  -  - 16,13 -  -  - 2 083 -  -  - 13,96 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 2 679 -  -  - 23,64 -  -  - 5 017 -  -  - 17,79 -  -  -  -  - ARA -  -  - 846 -  -  - 16,05 -  -  - 1 902 -  -  - 13,91 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 2 533 -  -  - 23,68 -  -  - 4 925 -  -  - 17,85 -  -  -  -  - ARA -  -  - 763 -  -  - 15,97 -  -  - 1 778 -  -  - 13,90 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 2 548 -  -  - 23,77 -  -  - 4 882 -  -  - 17,99 -  -  -  -  - ARA -  -  - 767 -  -  - 15,98 -  -  - 1 744 -  -  - 13,97 -  -  -  -  - Turku -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 5 534 -  -  - 18,16 -  -  - 4 267 -  -  - 14,07 -  -  -  -  - ARA -  -  - 1 292 -  -  - 13,91 -  -  - 1 782 -  -  - 11,81 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 4 437 -  -  - 18,32 -  -  - 3 666 -  -  - 14,27 -  -  -  -  - ARA -  -  - 1 149 -  -  - 14,02 -  -  - 1 642 -  -  - 11,87 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 4 014 -  -  - 18,44 -  -  - 3 329 -  -  - 14,37 -  -  -  -  - ARA -  -  - 1 107 -  -  - 14,06 -  -  - 1 554 -  -  - 11,86 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 4 195 -  -  - 18,53 -  -  - 3 414 -  -  - 14,48 -  -  -  -  - ARA -  -  - 1 161 -  -  - 14,11 -  -  - 1 557 -  -  - 11,96 -  -  -  -  -  - Yksikkö: Lukumäärä: lukumäärä, Neliövuokra (eur/m2): eur / m2 -  -  - 
 - Lähde: PxVisualizer-fi - 
 -" +
+

+ Tiedot 2022Q1-2022Q4 muuttujina Tiedot, Alue, Huoneluku, Rahoitusmuoto +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Yksiöt + + Kaksiot +
+ Lukumäärä + + Neliövuokra (eur/m2) + + Lukumäärä + + Neliövuokra (eur/m2) +
+ Helsinki + + 2022Q1 + + Vapaarahoitteinen + + 13 021 + + 26,64 + + 10 080 + + 20,22 +
+ ARA + + 3 810 + + 15,90 + + 6 176 + + 13,74 +
+ 2022Q2 + + Vapaarahoitteinen + + 11 231 + + 26,82 + + 9 326 + + 20,45 +
+ ARA + + 3 552 + + 15,97 + + 5 749 + + 13,78 +
+ 2022Q3 + + Vapaarahoitteinen + + 10 269 + + 26,93 + + 8 907 + + 20,59 +
+ ARA + + 3 249 + + 15,99 + + 5 280 + + 13,79 +
+ 2022Q4 + + Vapaarahoitteinen + + 10 272 + + 26,93 + + 8 805 + + 20,66 +
+ ARA + + 3 323 + + 16,08 + + 5 265 + + 13,80 +
+ Vantaa + + 2022Q1 + + Vapaarahoitteinen + + 3 043 + + 23,48 + + 5 261 + + 17,62 +
+ ARA + + 941 + + 16,13 + + 2 083 + + 13,96 +
+ 2022Q2 + + Vapaarahoitteinen + + 2 679 + + 23,64 + + 5 017 + + 17,79 +
+ ARA + + 846 + + 16,05 + + 1 902 + + 13,91 +
+ 2022Q3 + + Vapaarahoitteinen + + 2 533 + + 23,68 + + 4 925 + + 17,85 +
+ ARA + + 763 + + 15,97 + + 1 778 + + 13,90 +
+ 2022Q4 + + Vapaarahoitteinen + + 2 548 + + 23,77 + + 4 882 + + 17,99 +
+ ARA + + 767 + + 15,98 + + 1 744 + + 13,97 +
+ Turku + + 2022Q1 + + Vapaarahoitteinen + + 5 534 + + 18,16 + + 4 267 + + 14,07 +
+ ARA + + 1 292 + + 13,91 + + 1 782 + + 11,81 +
+ 2022Q2 + + Vapaarahoitteinen + + 4 437 + + 18,32 + + 3 666 + + 14,27 +
+ ARA + + 1 149 + + 14,02 + + 1 642 + + 11,87 +
+ 2022Q3 + + Vapaarahoitteinen + + 4 014 + + 18,44 + + 3 329 + + 14,37 +
+ ARA + + 1 107 + + 14,06 + + 1 554 + + 11,86 +
+ 2022Q4 + + Vapaarahoitteinen + + 4 195 + + 18,53 + + 3 414 + + 14,48 +
+ ARA + + 1 161 + + 14,11 + + 1 557 + + 11,96 +
+ + Yksikkö: Lukumäärä: lukumäärä, Neliövuokra (eur/m2): eur / m2 + + +
+ Lähde: PxVisualizer-fi +
+
`; exports[`Html table render tests should match snapshot: Table with row and column variables and footnote when given 1`] = ` -" -  - Tiedot 2022Q1-2022Q4 muuttujina Tiedot, Alue, Huoneluku, Rahoitusmuoto - 

 -  -  -  -  -  - Yksiöt -  -  - Kaksiot -  -  -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  -  -  -  -  - Helsinki -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 13 021 -  -  - 26,64 -  -  - 10 080 -  -  - 20,22 -  -  -  -  - ARA -  -  - 3 810 -  -  - 15,90 -  -  - 6 176 -  -  - 13,74 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 11 231 -  -  - 26,82 -  -  - 9 326 -  -  - 20,45 -  -  -  -  - ARA -  -  - 3 552 -  -  - 15,97 -  -  - 5 749 -  -  - 13,78 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 10 269 -  -  - 26,93 -  -  - 8 907 -  -  - 20,59 -  -  -  -  - ARA -  -  - 3 249 -  -  - 15,99 -  -  - 5 280 -  -  - 13,79 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 10 272 -  -  - 26,93 -  -  - 8 805 -  -  - 20,66 -  -  -  -  - ARA -  -  - 3 323 -  -  - 16,08 -  -  - 5 265 -  -  - 13,80 -  -  -  -  - Vantaa -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 3 043 -  -  - 23,48 -  -  - 5 261 -  -  - 17,62 -  -  -  -  - ARA -  -  - 941 -  -  - 16,13 -  -  - 2 083 -  -  - 13,96 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 2 679 -  -  - 23,64 -  -  - 5 017 -  -  - 17,79 -  -  -  -  - ARA -  -  - 846 -  -  - 16,05 -  -  - 1 902 -  -  - 13,91 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 2 533 -  -  - 23,68 -  -  - 4 925 -  -  - 17,85 -  -  -  -  - ARA -  -  - 763 -  -  - 15,97 -  -  - 1 778 -  -  - 13,90 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 2 548 -  -  - 23,77 -  -  - 4 882 -  -  - 17,99 -  -  -  -  - ARA -  -  - 767 -  -  - 15,98 -  -  - 1 744 -  -  - 13,97 -  -  -  -  - Turku -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 5 534 -  -  - 18,16 -  -  - 4 267 -  -  - 14,07 -  -  -  -  - ARA -  -  - 1 292 -  -  - 13,91 -  -  - 1 782 -  -  - 11,81 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 4 437 -  -  - 18,32 -  -  - 3 666 -  -  - 14,27 -  -  -  -  - ARA -  -  - 1 149 -  -  - 14,02 -  -  - 1 642 -  -  - 11,87 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 4 014 -  -  - 18,44 -  -  - 3 329 -  -  - 14,37 -  -  -  -  - ARA -  -  - 1 107 -  -  - 14,06 -  -  - 1 554 -  -  - 11,86 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 4 195 -  -  - 18,53 -  -  - 3 414 -  -  - 14,48 -  -  -  -  - ARA -  -  - 1 161 -  -  - 14,11 -  -  - 1 557 -  -  - 11,96 -  -  -  -  -  - Test footnote -  -" +
+

+ Tiedot 2022Q1-2022Q4 muuttujina Tiedot, Alue, Huoneluku, Rahoitusmuoto +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Yksiöt + + Kaksiot +
+ Lukumäärä + + Neliövuokra (eur/m2) + + Lukumäärä + + Neliövuokra (eur/m2) +
+ Helsinki + + 2022Q1 + + Vapaarahoitteinen + + 13 021 + + 26,64 + + 10 080 + + 20,22 +
+ ARA + + 3 810 + + 15,90 + + 6 176 + + 13,74 +
+ 2022Q2 + + Vapaarahoitteinen + + 11 231 + + 26,82 + + 9 326 + + 20,45 +
+ ARA + + 3 552 + + 15,97 + + 5 749 + + 13,78 +
+ 2022Q3 + + Vapaarahoitteinen + + 10 269 + + 26,93 + + 8 907 + + 20,59 +
+ ARA + + 3 249 + + 15,99 + + 5 280 + + 13,79 +
+ 2022Q4 + + Vapaarahoitteinen + + 10 272 + + 26,93 + + 8 805 + + 20,66 +
+ ARA + + 3 323 + + 16,08 + + 5 265 + + 13,80 +
+ Vantaa + + 2022Q1 + + Vapaarahoitteinen + + 3 043 + + 23,48 + + 5 261 + + 17,62 +
+ ARA + + 941 + + 16,13 + + 2 083 + + 13,96 +
+ 2022Q2 + + Vapaarahoitteinen + + 2 679 + + 23,64 + + 5 017 + + 17,79 +
+ ARA + + 846 + + 16,05 + + 1 902 + + 13,91 +
+ 2022Q3 + + Vapaarahoitteinen + + 2 533 + + 23,68 + + 4 925 + + 17,85 +
+ ARA + + 763 + + 15,97 + + 1 778 + + 13,90 +
+ 2022Q4 + + Vapaarahoitteinen + + 2 548 + + 23,77 + + 4 882 + + 17,99 +
+ ARA + + 767 + + 15,98 + + 1 744 + + 13,97 +
+ Turku + + 2022Q1 + + Vapaarahoitteinen + + 5 534 + + 18,16 + + 4 267 + + 14,07 +
+ ARA + + 1 292 + + 13,91 + + 1 782 + + 11,81 +
+ 2022Q2 + + Vapaarahoitteinen + + 4 437 + + 18,32 + + 3 666 + + 14,27 +
+ ARA + + 1 149 + + 14,02 + + 1 642 + + 11,87 +
+ 2022Q3 + + Vapaarahoitteinen + + 4 014 + + 18,44 + + 3 329 + + 14,37 +
+ ARA + + 1 107 + + 14,06 + + 1 554 + + 11,86 +
+ 2022Q4 + + Vapaarahoitteinen + + 4 195 + + 18,53 + + 3 414 + + 14,48 +
+ ARA + + 1 161 + + 14,11 + + 1 557 + + 11,96 +
+ + Test footnote + +
`; exports[`Html table render tests should match snapshot: Table with row and column variables and title disabled 1`] = ` -" -  -  -  -  -  - Yksiöt -  -  - Kaksiot -  -  -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  -  -  -  -  - Helsinki -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 13 021 -  -  - 26,64 -  -  - 10 080 -  -  - 20,22 -  -  -  -  - ARA -  -  - 3 810 -  -  - 15,90 -  -  - 6 176 -  -  - 13,74 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 11 231 -  -  - 26,82 -  -  - 9 326 -  -  - 20,45 -  -  -  -  - ARA -  -  - 3 552 -  -  - 15,97 -  -  - 5 749 -  -  - 13,78 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 10 269 -  -  - 26,93 -  -  - 8 907 -  -  - 20,59 -  -  -  -  - ARA -  -  - 3 249 -  -  - 15,99 -  -  - 5 280 -  -  - 13,79 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 10 272 -  -  - 26,93 -  -  - 8 805 -  -  - 20,66 -  -  -  -  - ARA -  -  - 3 323 -  -  - 16,08 -  -  - 5 265 -  -  - 13,80 -  -  -  -  - Vantaa -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 3 043 -  -  - 23,48 -  -  - 5 261 -  -  - 17,62 -  -  -  -  - ARA -  -  - 941 -  -  - 16,13 -  -  - 2 083 -  -  - 13,96 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 2 679 -  -  - 23,64 -  -  - 5 017 -  -  - 17,79 -  -  -  -  - ARA -  -  - 846 -  -  - 16,05 -  -  - 1 902 -  -  - 13,91 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 2 533 -  -  - 23,68 -  -  - 4 925 -  -  - 17,85 -  -  -  -  - ARA -  -  - 763 -  -  - 15,97 -  -  - 1 778 -  -  - 13,90 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 2 548 -  -  - 23,77 -  -  - 4 882 -  -  - 17,99 -  -  -  -  - ARA -  -  - 767 -  -  - 15,98 -  -  - 1 744 -  -  - 13,97 -  -  -  -  - Turku -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 5 534 -  -  - 18,16 -  -  - 4 267 -  -  - 14,07 -  -  -  -  - ARA -  -  - 1 292 -  -  - 13,91 -  -  - 1 782 -  -  - 11,81 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 4 437 -  -  - 18,32 -  -  - 3 666 -  -  - 14,27 -  -  -  -  - ARA -  -  - 1 149 -  -  - 14,02 -  -  - 1 642 -  -  - 11,87 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 4 014 -  -  - 18,44 -  -  - 3 329 -  -  - 14,37 -  -  -  -  - ARA -  -  - 1 107 -  -  - 14,06 -  -  - 1 554 -  -  - 11,86 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 4 195 -  -  - 18,53 -  -  - 3 414 -  -  - 14,48 -  -  -  -  - ARA -  -  - 1 161 -  -  - 14,11 -  -  - 1 557 -  -  - 11,96 -  -  -  -  -  - Yksikkö: Lukumäärä: lukumäärä, Neliövuokra (eur/m2): eur / m2 -  -  - 
 - Lähde: PxVisualizer-fi - 
 -" +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Yksiöt + + Kaksiot +
+ Lukumäärä + + Neliövuokra (eur/m2) + + Lukumäärä + + Neliövuokra (eur/m2) +
+ Helsinki + + 2022Q1 + + Vapaarahoitteinen + + 13 021 + + 26,64 + + 10 080 + + 20,22 +
+ ARA + + 3 810 + + 15,90 + + 6 176 + + 13,74 +
+ 2022Q2 + + Vapaarahoitteinen + + 11 231 + + 26,82 + + 9 326 + + 20,45 +
+ ARA + + 3 552 + + 15,97 + + 5 749 + + 13,78 +
+ 2022Q3 + + Vapaarahoitteinen + + 10 269 + + 26,93 + + 8 907 + + 20,59 +
+ ARA + + 3 249 + + 15,99 + + 5 280 + + 13,79 +
+ 2022Q4 + + Vapaarahoitteinen + + 10 272 + + 26,93 + + 8 805 + + 20,66 +
+ ARA + + 3 323 + + 16,08 + + 5 265 + + 13,80 +
+ Vantaa + + 2022Q1 + + Vapaarahoitteinen + + 3 043 + + 23,48 + + 5 261 + + 17,62 +
+ ARA + + 941 + + 16,13 + + 2 083 + + 13,96 +
+ 2022Q2 + + Vapaarahoitteinen + + 2 679 + + 23,64 + + 5 017 + + 17,79 +
+ ARA + + 846 + + 16,05 + + 1 902 + + 13,91 +
+ 2022Q3 + + Vapaarahoitteinen + + 2 533 + + 23,68 + + 4 925 + + 17,85 +
+ ARA + + 763 + + 15,97 + + 1 778 + + 13,90 +
+ 2022Q4 + + Vapaarahoitteinen + + 2 548 + + 23,77 + + 4 882 + + 17,99 +
+ ARA + + 767 + + 15,98 + + 1 744 + + 13,97 +
+ Turku + + 2022Q1 + + Vapaarahoitteinen + + 5 534 + + 18,16 + + 4 267 + + 14,07 +
+ ARA + + 1 292 + + 13,91 + + 1 782 + + 11,81 +
+ 2022Q2 + + Vapaarahoitteinen + + 4 437 + + 18,32 + + 3 666 + + 14,27 +
+ ARA + + 1 149 + + 14,02 + + 1 642 + + 11,87 +
+ 2022Q3 + + Vapaarahoitteinen + + 4 014 + + 18,44 + + 3 329 + + 14,37 +
+ ARA + + 1 107 + + 14,06 + + 1 554 + + 11,86 +
+ 2022Q4 + + Vapaarahoitteinen + + 4 195 + + 18,53 + + 3 414 + + 14,48 +
+ ARA + + 1 161 + + 14,11 + + 1 557 + + 11,96 +
+ + Yksikkö: Lukumäärä: lukumäärä, Neliövuokra (eur/m2): eur / m2 + + +
+ Lähde: PxVisualizer-fi +
+
`; exports[`Html table render tests should match snapshot: Table with row and column variables and units and sources disabled 1`] = ` -" -  - Tiedot 2022Q1-2022Q4 muuttujina Tiedot, Alue, Huoneluku, Rahoitusmuoto - 

 -  -  -  -  -  - Yksiöt -  -  - Kaksiot -  -  -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  - Lukumäärä -  -  - Neliövuokra (eur/m2) -  -  -  -  -  -  - Helsinki -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 13 021 -  -  - 26,64 -  -  - 10 080 -  -  - 20,22 -  -  -  -  - ARA -  -  - 3 810 -  -  - 15,90 -  -  - 6 176 -  -  - 13,74 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 11 231 -  -  - 26,82 -  -  - 9 326 -  -  - 20,45 -  -  -  -  - ARA -  -  - 3 552 -  -  - 15,97 -  -  - 5 749 -  -  - 13,78 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 10 269 -  -  - 26,93 -  -  - 8 907 -  -  - 20,59 -  -  -  -  - ARA -  -  - 3 249 -  -  - 15,99 -  -  - 5 280 -  -  - 13,79 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 10 272 -  -  - 26,93 -  -  - 8 805 -  -  - 20,66 -  -  -  -  - ARA -  -  - 3 323 -  -  - 16,08 -  -  - 5 265 -  -  - 13,80 -  -  -  -  - Vantaa -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 3 043 -  -  - 23,48 -  -  - 5 261 -  -  - 17,62 -  -  -  -  - ARA -  -  - 941 -  -  - 16,13 -  -  - 2 083 -  -  - 13,96 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 2 679 -  -  - 23,64 -  -  - 5 017 -  -  - 17,79 -  -  -  -  - ARA -  -  - 846 -  -  - 16,05 -  -  - 1 902 -  -  - 13,91 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 2 533 -  -  - 23,68 -  -  - 4 925 -  -  - 17,85 -  -  -  -  - ARA -  -  - 763 -  -  - 15,97 -  -  - 1 778 -  -  - 13,90 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 2 548 -  -  - 23,77 -  -  - 4 882 -  -  - 17,99 -  -  -  -  - ARA -  -  - 767 -  -  - 15,98 -  -  - 1 744 -  -  - 13,97 -  -  -  -  - Turku -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - 5 534 -  -  - 18,16 -  -  - 4 267 -  -  - 14,07 -  -  -  -  - ARA -  -  - 1 292 -  -  - 13,91 -  -  - 1 782 -  -  - 11,81 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - 4 437 -  -  - 18,32 -  -  - 3 666 -  -  - 14,27 -  -  -  -  - ARA -  -  - 1 149 -  -  - 14,02 -  -  - 1 642 -  -  - 11,87 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - 4 014 -  -  - 18,44 -  -  - 3 329 -  -  - 14,37 -  -  -  -  - ARA -  -  - 1 107 -  -  - 14,06 -  -  - 1 554 -  -  - 11,86 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - 4 195 -  -  - 18,53 -  -  - 3 414 -  -  - 14,48 -  -  -  -  - ARA -  -  - 1 161 -  -  - 14,11 -  -  - 1 557 -  -  - 11,96 -  -  -  -  -" +
+

+ Tiedot 2022Q1-2022Q4 muuttujina Tiedot, Alue, Huoneluku, Rahoitusmuoto +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Yksiöt + + Kaksiot +
+ Lukumäärä + + Neliövuokra (eur/m2) + + Lukumäärä + + Neliövuokra (eur/m2) +
+ Helsinki + + 2022Q1 + + Vapaarahoitteinen + + 13 021 + + 26,64 + + 10 080 + + 20,22 +
+ ARA + + 3 810 + + 15,90 + + 6 176 + + 13,74 +
+ 2022Q2 + + Vapaarahoitteinen + + 11 231 + + 26,82 + + 9 326 + + 20,45 +
+ ARA + + 3 552 + + 15,97 + + 5 749 + + 13,78 +
+ 2022Q3 + + Vapaarahoitteinen + + 10 269 + + 26,93 + + 8 907 + + 20,59 +
+ ARA + + 3 249 + + 15,99 + + 5 280 + + 13,79 +
+ 2022Q4 + + Vapaarahoitteinen + + 10 272 + + 26,93 + + 8 805 + + 20,66 +
+ ARA + + 3 323 + + 16,08 + + 5 265 + + 13,80 +
+ Vantaa + + 2022Q1 + + Vapaarahoitteinen + + 3 043 + + 23,48 + + 5 261 + + 17,62 +
+ ARA + + 941 + + 16,13 + + 2 083 + + 13,96 +
+ 2022Q2 + + Vapaarahoitteinen + + 2 679 + + 23,64 + + 5 017 + + 17,79 +
+ ARA + + 846 + + 16,05 + + 1 902 + + 13,91 +
+ 2022Q3 + + Vapaarahoitteinen + + 2 533 + + 23,68 + + 4 925 + + 17,85 +
+ ARA + + 763 + + 15,97 + + 1 778 + + 13,90 +
+ 2022Q4 + + Vapaarahoitteinen + + 2 548 + + 23,77 + + 4 882 + + 17,99 +
+ ARA + + 767 + + 15,98 + + 1 744 + + 13,97 +
+ Turku + + 2022Q1 + + Vapaarahoitteinen + + 5 534 + + 18,16 + + 4 267 + + 14,07 +
+ ARA + + 1 292 + + 13,91 + + 1 782 + + 11,81 +
+ 2022Q2 + + Vapaarahoitteinen + + 4 437 + + 18,32 + + 3 666 + + 14,27 +
+ ARA + + 1 149 + + 14,02 + + 1 642 + + 11,87 +
+ 2022Q3 + + Vapaarahoitteinen + + 4 014 + + 18,44 + + 3 329 + + 14,37 +
+ ARA + + 1 107 + + 14,06 + + 1 554 + + 11,86 +
+ 2022Q4 + + Vapaarahoitteinen + + 4 195 + + 18,53 + + 3 414 + + 14,48 +
+ ARA + + 1 161 + + 14,11 + + 1 557 + + 11,96 +
+
`; exports[`Html table render tests should match snapshot: Table with row variables only 1`] = ` -" -  - Lukumäärä 2022Q1-2022Q4 muuttujina Alue, Huoneluku, Rahoitusmuoto - 

 -  -  -  -  - Vantaa -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 3 043 -  -  -  -  - Kaksiot -  -  - 5 261 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 941 -  -  -  -  - Kaksiot -  -  - 2 083 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 2 679 -  -  -  -  - Kaksiot -  -  - 5 017 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 846 -  -  -  -  - Kaksiot -  -  - 1 902 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 2 533 -  -  -  -  - Kaksiot -  -  - 4 925 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 763 -  -  -  -  - Kaksiot -  -  - 1 778 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 2 548 -  -  -  -  - Kaksiot -  -  - 4 882 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 767 -  -  -  -  - Kaksiot -  -  - 1 744 -  -  -  -  - Turku -  -  - 2022Q1 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 5 534 -  -  -  -  - Kaksiot -  -  - 4 267 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 1 292 -  -  -  -  - Kaksiot -  -  - 1 782 -  -  -  -  - 2022Q2 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 4 437 -  -  -  -  - Kaksiot -  -  - 3 666 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 1 149 -  -  -  -  - Kaksiot -  -  - 1 642 -  -  -  -  - 2022Q3 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 4 014 -  -  -  -  - Kaksiot -  -  - 3 329 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 1 107 -  -  -  -  - Kaksiot -  -  - 1 554 -  -  -  -  - 2022Q4 -  -  - Vapaarahoitteinen -  -  - Yksiöt -  -  - 4 195 -  -  -  -  - Kaksiot -  -  - 3 414 -  -  -  -  - ARA -  -  - Yksiöt -  -  - 1 161 -  -  -  -  - Kaksiot -  -  - 1 557 -  -  -  -  -  - Yksikkö: lukumäärä -  -  - 
 - Lähde: PxVisualizer-fi - 
 -" +
+

+ Lukumäärä 2022Q1-2022Q4 muuttujina Alue, Huoneluku, Rahoitusmuoto +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Vantaa + + 2022Q1 + + Vapaarahoitteinen + + Yksiöt + + 3 043 +
+ Kaksiot + + 5 261 +
+ ARA + + Yksiöt + + 941 +
+ Kaksiot + + 2 083 +
+ 2022Q2 + + Vapaarahoitteinen + + Yksiöt + + 2 679 +
+ Kaksiot + + 5 017 +
+ ARA + + Yksiöt + + 846 +
+ Kaksiot + + 1 902 +
+ 2022Q3 + + Vapaarahoitteinen + + Yksiöt + + 2 533 +
+ Kaksiot + + 4 925 +
+ ARA + + Yksiöt + + 763 +
+ Kaksiot + + 1 778 +
+ 2022Q4 + + Vapaarahoitteinen + + Yksiöt + + 2 548 +
+ Kaksiot + + 4 882 +
+ ARA + + Yksiöt + + 767 +
+ Kaksiot + + 1 744 +
+ Turku + + 2022Q1 + + Vapaarahoitteinen + + Yksiöt + + 5 534 +
+ Kaksiot + + 4 267 +
+ ARA + + Yksiöt + + 1 292 +
+ Kaksiot + + 1 782 +
+ 2022Q2 + + Vapaarahoitteinen + + Yksiöt + + 4 437 +
+ Kaksiot + + 3 666 +
+ ARA + + Yksiöt + + 1 149 +
+ Kaksiot + + 1 642 +
+ 2022Q3 + + Vapaarahoitteinen + + Yksiöt + + 4 014 +
+ Kaksiot + + 3 329 +
+ ARA + + Yksiöt + + 1 107 +
+ Kaksiot + + 1 554 +
+ 2022Q4 + + Vapaarahoitteinen + + Yksiöt + + 4 195 +
+ Kaksiot + + 3 414 +
+ ARA + + Yksiöt + + 1 161 +
+ Kaksiot + + 1 557 +
+ + Yksikkö: lukumäärä + + +
+ Lähde: PxVisualizer-fi +
+
`; exports[`Html table render tests should match snapshot: Table with source and footnote 1`] = ` -" -  - Lukumäärä, Vantaa, Yksiöt, Vapaarahoitteinen 2022Q4 - 

 -  -  -  -  - 2 548 -  -  -  -  -  - Yksikkö: lukumäärä -  -  - 
 - Test footnote - 
 -  - 
 - Lähde: PxVisualizer-fi - 
 -" +
+

+ Lukumäärä, Vantaa, Yksiöt, Vapaarahoitteinen 2022Q4 +

+ + + + + + +
+ 2 548 +
+ + Yksikkö: lukumäärä + + +
+ Test footnote +
+ +
+ Lähde: PxVisualizer-fi +
+
`; diff --git a/src/core/tables/csvTable.test.ts b/src/core/tables/csvTable.test.ts index d0c0125..fe5e943 100644 --- a/src/core/tables/csvTable.test.ts +++ b/src/core/tables/csvTable.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { VIEW_WITH_COMPLEX_ROW_AND_COLUMN_VARIABLES } from "../conversion/fixtures/exportingUtils"; import { generateCsv } from "./csvTable"; import { CSV_FIXTURES_COMPLEX_VIEW_ROW_AND_COL_VARS, CSV_FIXTURES_COL_VARS, CSV_FIXTURES_ROW_VARS, CSV_FIXTURES_ONE_CELL, CSV_FIXTURES_ROW_AND_COL_VARS } from "./fixtures/csvFixtures"; diff --git a/src/core/tables/exportingUtils.test.ts b/src/core/tables/exportingUtils.test.ts index 51de34b..b1f3e3e 100644 --- a/src/core/tables/exportingUtils.test.ts +++ b/src/core/tables/exportingUtils.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { generateFilename } from "./exportingUtils"; describe('filenme tests', () => { diff --git a/src/core/tables/htmlTable.test.ts b/src/core/tables/htmlTable.test.ts index 8c89ed8..fd61785 100644 --- a/src/core/tables/htmlTable.test.ts +++ b/src/core/tables/htmlTable.test.ts @@ -1,284 +1,116 @@ -import { prettyDOM } from "@testing-library/dom"; +import { describe, expect, it, jest } from "@jest/globals"; import { TABLE_WITH_ONE_CELL, TABLE_WITH_ONLY_ROW_VARIABLES, TABLE_WITH_ROW_AND_COLUMN_VARIABLES } from "../../stories/fixtures/table"; import { SELECTABLE_TABLE_WITH_MISSING_DATA, TABLE_WITH_ONLY_COLUMN_VARIABLES } from "../conversion/fixtures/tableChart"; import { extractSelectableVariableValues } from "../conversion/helpers"; import { convertPxGrafResponseToView } from "../conversion/viewUtils"; import { renderHtmlTable } from "./htmlTable"; import { SELECTABLE_TABLE_WITH_INVALID_MISSING_DATA } from "./fixtures/pxGrafResponses"; -import { IChartOptions } from "../types/chartOptions"; +import type { IChartOptions, IQueryVisualizationResponse } from "../types"; +import type { TVariableSelections } from "../types/variableSelections"; + +const defaultSettings: IChartOptions = { + showTitles: true, + showUnits: true, + showSources: true, + showLastUpdated: false +}; + +interface IHtmlTableTestCase { + title: string; + response: IQueryVisualizationResponse; + selectedValueCodes?: TVariableSelections; + testId: string; + settings?: IChartOptions; + footnote?: string; +} + +const renderTestTable = ({ response, selectedValueCodes, testId, settings = defaultSettings, footnote }: IHtmlTableTestCase) => { + const variableSelections = extractSelectableVariableValues( + response.selectableVariableCodes, + response.metaData, + response.visualizationSettings.defaultSelectableVariableCodes, + selectedValueCodes); + const view = convertPxGrafResponseToView(response, variableSelections); + const container = document.createElement('div'); + container.id = testId; + document.body.appendChild(container); + renderHtmlTable(view, 'fi', settings, testId, footnote); + return container; +}; + +const testCases: IHtmlTableTestCase[] = [ + { + title: 'Table with column variables only', + response: TABLE_WITH_ONLY_COLUMN_VARIABLES.pxGraphData, + selectedValueCodes: TABLE_WITH_ONLY_COLUMN_VARIABLES.selectedVariableCodes, + testId: 'test-49857934857938475938475' + }, + { + title: 'Table with row variables only', + response: TABLE_WITH_ONLY_ROW_VARIABLES.pxGraphData, + selectedValueCodes: TABLE_WITH_ONLY_ROW_VARIABLES.selectedVariableCodes, + testId: 'test-9483567287648723649867' + }, + { + title: 'Table with row and column variables', + response: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, + selectedValueCodes: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes, + testId: 'test-4329874982374983798' + }, + { + title: 'Table with row and column variables and title disabled', + response: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, + selectedValueCodes: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes, + testId: 'test-4329874982374983798', + settings: { ...defaultSettings, showTitles: false } + }, + { + title: 'Table with row and column variables and units and sources disabled', + response: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, + selectedValueCodes: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes, + testId: 'test-4329874982374983798', + settings: { ...defaultSettings, showUnits: false, showSources: false } + }, + { + title: 'Table with row and column variables and footnote when given', + response: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, + selectedValueCodes: TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes, + testId: 'test-4329874982374983798', + settings: { ...defaultSettings, showUnits: false, showSources: false }, + footnote: 'Test footnote' + }, + { + title: 'Table with only one cell', + response: TABLE_WITH_ONE_CELL.pxGraphData, + selectedValueCodes: TABLE_WITH_ONE_CELL.selectedVariableCodes, + testId: 'test-6895638450983059889' + }, + { + title: 'Table with source and footnote', + response: TABLE_WITH_ONE_CELL.pxGraphData, + selectedValueCodes: TABLE_WITH_ONE_CELL.selectedVariableCodes, + testId: 'test-6895638450983059889', + footnote: 'Test footnote' + }, + { + title: 'Table with missing data and selectable values', + response: SELECTABLE_TABLE_WITH_MISSING_DATA, + selectedValueCodes: { + "Talotyyppi": ["1"], + "Huoneluku": ["02"] + }, + testId: 'test-84957394875983745' + } +]; describe('Html table render tests', () => { - it('should match snapshot: Table with column variables only', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ONLY_COLUMN_VARIABLES.pxGraphData.selectableVariableCodes, - TABLE_WITH_ONLY_COLUMN_VARIABLES.pxGraphData.metaData, - TABLE_WITH_ONLY_COLUMN_VARIABLES.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ONLY_COLUMN_VARIABLES.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ONLY_COLUMN_VARIABLES.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-49857934857938475938475'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with row variables only', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ONLY_ROW_VARIABLES.pxGraphData.selectableVariableCodes, - TABLE_WITH_ONLY_ROW_VARIABLES.pxGraphData.metaData, - TABLE_WITH_ONLY_ROW_VARIABLES.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ONLY_ROW_VARIABLES.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ONLY_ROW_VARIABLES.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-9483567287648723649867'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with row and column variables', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.selectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.metaData, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-4329874982374983798'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with row and column variables and title disabled', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.selectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.metaData, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-4329874982374983798'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: false, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with row and column variables and units and sources disabled', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.selectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.metaData, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-4329874982374983798'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: false, - showSources: false, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with row and column variables and footnote when given', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.selectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.metaData, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ROW_AND_COLUMN_VARIABLES.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ROW_AND_COLUMN_VARIABLES.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-4329874982374983798'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: false, - showSources: false, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId, 'Test footnote'); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with only one cell', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ONE_CELL.pxGraphData.selectableVariableCodes, - TABLE_WITH_ONE_CELL.pxGraphData.metaData, - TABLE_WITH_ONE_CELL.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ONE_CELL.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ONE_CELL.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-6895638450983059889'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with source and footnote', () => { - const mockVarSelections = extractSelectableVariableValues( - TABLE_WITH_ONE_CELL.pxGraphData.selectableVariableCodes, - TABLE_WITH_ONE_CELL.pxGraphData.metaData, - TABLE_WITH_ONE_CELL.pxGraphData.visualizationSettings.defaultSelectableVariableCodes, - TABLE_WITH_ONE_CELL.selectedVariableCodes); - const mockView = convertPxGrafResponseToView(TABLE_WITH_ONE_CELL.pxGraphData, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-6895638450983059889'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId, 'Test footnote'); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - }); - - it('should match snapshot: Table with missing data and selectable values', () => { - const mockVarSelections = extractSelectableVariableValues( - SELECTABLE_TABLE_WITH_MISSING_DATA.selectableVariableCodes, - SELECTABLE_TABLE_WITH_MISSING_DATA.metaData, - SELECTABLE_TABLE_WITH_MISSING_DATA.visualizationSettings.defaultSelectableVariableCodes, - { - "Talotyyppi": ["1"], - "Huoneluku": ["02"] - }); - const mockView = convertPxGrafResponseToView(SELECTABLE_TABLE_WITH_MISSING_DATA, mockVarSelections); - const locale = 'fi'; - - const testId = 'test-84957394875983745'; - - const div = document.createElement('div'); - div.id = testId; - document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); + it.each(testCases)('should match snapshot: $title', (testCase) => { + const container = renderTestTable(testCase); + try { + expect(container).toMatchSnapshot(); + } finally { + container.remove(); + } }); it('should match snapshot: Table with invalid missing data should render error message', () => { @@ -290,31 +122,17 @@ describe('Html table render tests', () => { "Huoneluku": ["02"] }); const mockView = convertPxGrafResponseToView(SELECTABLE_TABLE_WITH_INVALID_MISSING_DATA, mockVarSelections); - const locale = 'fi'; - const testId = 'test-84957394875983745'; - - const spy = jest.spyOn(console, "error"); - spy.mockImplementation(() => { }); - + const errorSpy = jest.spyOn(console, "error").mockImplementation(() => undefined); const div = document.createElement('div'); div.id = testId; document.body.appendChild(div); - - const settings: IChartOptions = { - showTitles: true, - showUnits: true, - showSources: true, - showLastUpdated: false - }; - - renderHtmlTable(mockView, locale, settings, testId); - - const renderedOutput = prettyDOM(div); - expect(renderedOutput).toMatchSnapshot(); - - document.body.removeChild(div); - - spy.mockRestore(); + try { + renderHtmlTable(mockView, 'fi', defaultSettings, testId); + expect(div).toMatchSnapshot(); + } finally { + div.remove(); + errorSpy.mockRestore(); + } }); }); \ No newline at end of file diff --git a/src/core/tables/tableUtils.test.ts b/src/core/tables/tableUtils.test.ts index cd9b774..30f399e 100644 --- a/src/core/tables/tableUtils.test.ts +++ b/src/core/tables/tableUtils.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { IDataCell } from "../types/view"; import { formatMissingData, formatNumericValue } from "./tableUtils"; diff --git a/src/core/tables/xlsx/__snapshots__/xlsxWorksheetBuilder.test.ts.snap b/src/core/tables/xlsx/__snapshots__/xlsxWorksheetBuilder.test.ts.snap index 6bd13c3..28ef73e 100644 --- a/src/core/tables/xlsx/__snapshots__/xlsxWorksheetBuilder.test.ts.snap +++ b/src/core/tables/xlsx/__snapshots__/xlsxWorksheetBuilder.test.ts.snap @@ -10,7 +10,7 @@ exports[`Worksheet xml generation tests Should generate expected xml output with " `; -exports[`Worksheet xml generation tests Should generate expexted xml output with the provided fixture with en locale 1`] = ` +exports[`Worksheet xml generation tests Should generate expected xml output with the provided fixture with en locale 1`] = ` " ,,,,, @@ -20,7 +20,7 @@ exports[`Worksheet xml generation tests Should generate expexted xml output with " `; -exports[`Worksheet xml generation tests Should generate expexted xml output with the provided fixture with fi locale 1`] = ` +exports[`Worksheet xml generation tests Should generate expected xml output with the provided fixture with fi locale 1`] = ` " ,,,,, @@ -30,7 +30,7 @@ exports[`Worksheet xml generation tests Should generate expexted xml output with " `; -exports[`Worksheet xml generation tests Should generate expexted xml output with the provided fixture with sv locale 1`] = ` +exports[`Worksheet xml generation tests Should generate expected xml output with the provided fixture with sv locale 1`] = ` " ,,,,, diff --git a/src/core/tables/xlsx/xlsxDataBuilder.test.ts b/src/core/tables/xlsx/xlsxDataBuilder.test.ts index c6c9137..d2bab1b 100644 --- a/src/core/tables/xlsx/xlsxDataBuilder.test.ts +++ b/src/core/tables/xlsx/xlsxDataBuilder.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { VIEW_WITH_COMPLEX_ROW_AND_COLUMN_VARIABLES } from "../../conversion/fixtures/exportingUtils"; import { extractSelectableVariableValues } from "../../conversion"; import { convertPxGrafResponseToView } from "../../conversion/viewUtils"; diff --git a/src/core/tables/xlsx/xlsxUtils.test.ts b/src/core/tables/xlsx/xlsxUtils.test.ts index 4d946f2..1c30511 100644 --- a/src/core/tables/xlsx/xlsxUtils.test.ts +++ b/src/core/tables/xlsx/xlsxUtils.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from '@jest/globals'; import { escapeXmlFunctionChars } from "./xlsxUtils"; describe('assertion tests', () => { diff --git a/src/core/tables/xlsx/xlsxWorksheetBuilder.test.ts b/src/core/tables/xlsx/xlsxWorksheetBuilder.test.ts index c25b7f1..ead2cc4 100644 --- a/src/core/tables/xlsx/xlsxWorksheetBuilder.test.ts +++ b/src/core/tables/xlsx/xlsxWorksheetBuilder.test.ts @@ -1,19 +1,10 @@ +import { describe, expect, it } from '@jest/globals'; import { XLSX_FIXTURES_COMPLEX_VIEW_ROW_AND_COL_VARS, XLSX_FIXTURES_ONE_CELL_ESCAPE_CHARACTERS } from "../fixtures/xlsxFixtures"; import { buildXMLSheet } from "./xlsxWorksheetBuilder"; describe('Worksheet xml generation tests', () => { - it('Should generate expexted xml output with the provided fixture with fi locale', () => { - const sheet : string = buildXMLSheet(XLSX_FIXTURES_COMPLEX_VIEW_ROW_AND_COL_VARS['fi']); - expect(sheet).toMatchSnapshot(); - }); - - it('Should generate expexted xml output with the provided fixture with sv locale', () => { - const sheet : string = buildXMLSheet(XLSX_FIXTURES_COMPLEX_VIEW_ROW_AND_COL_VARS['sv']); - expect(sheet).toMatchSnapshot(); - }); - - it('Should generate expexted xml output with the provided fixture with en locale', () => { - const sheet : string = buildXMLSheet(XLSX_FIXTURES_COMPLEX_VIEW_ROW_AND_COL_VARS['en']); + it.each(['fi', 'sv', 'en'] as const)('Should generate expected xml output with the provided fixture with %s locale', (locale) => { + const sheet: string = buildXMLSheet(XLSX_FIXTURES_COMPLEX_VIEW_ROW_AND_COL_VARS[locale]); expect(sheet).toMatchSnapshot(); }); diff --git a/src/react/components/ErrorBoundary/ErrorBoundary.test.tsx b/src/react/components/ErrorBoundary/ErrorBoundary.test.tsx index cdffba3..7e4a28a 100644 --- a/src/react/components/ErrorBoundary/ErrorBoundary.test.tsx +++ b/src/react/components/ErrorBoundary/ErrorBoundary.test.tsx @@ -1,3 +1,4 @@ +import { describe, expect, it, jest } from '@jest/globals'; import React from 'react'; import { ErrorBoundary } from "./ErrorBoundary"; import { render } from '@testing-library/react'; @@ -8,13 +9,18 @@ const TestComponent = () => { describe('ErrorBoundary', () => { it('should render the fallback component when an error is thrown', () => { - const { getByTestId } = render( - Error}> - - - ); - const fallback = getByTestId('fallback'); - expect(fallback).toBeTruthy(); + const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => undefined); + try { + const { getByTestId } = render( + Error}> + + + ); + expect(getByTestId('fallback')).toBeTruthy(); + expect(errorSpy).toHaveBeenCalled(); + } finally { + errorSpy.mockRestore(); + } }); it('should render the children when no error is thrown', () => { diff --git a/src/react/components/burgerMenu/burgerMenu.test.tsx b/src/react/components/burgerMenu/burgerMenu.test.tsx index 9924815..5ed5687 100644 --- a/src/react/components/burgerMenu/burgerMenu.test.tsx +++ b/src/react/components/burgerMenu/burgerMenu.test.tsx @@ -1,3 +1,4 @@ +import { beforeEach, describe, expect, it, jest } from '@jest/globals'; import { act, render, screen, waitFor, fireEvent } from "@testing-library/react"; import { BurgerMenu, calculateExportDimensions } from "./burgerMenu"; import { HORIZONTAL_BAR_CHART_ASCENDING } from "../../../core/conversion/fixtures/horizontalBarChart"; @@ -36,7 +37,7 @@ describe('burgerMenu, functional tests', () => { screen.getByRole('button').click(); }); await waitFor(() => { - expect(screen.getAllByRole('menuitem').length).toEqual(4); + expect(screen.getAllByRole('menuitem')).toHaveLength(4); expect(screen.getByText('Lataa taulukko (csv)')).toBeTruthy(); expect(screen.getByText('Lataa taulukko (xlsx)')).toBeTruthy(); expect(screen.getByText("N\u00E4yt\u00E4 taulukko")).toBeTruthy(); @@ -51,7 +52,7 @@ describe('burgerMenu, functional tests', () => { screen.getByRole('button').click(); }); await waitFor(() => { - expect(screen.getAllByRole('menuitem').length).toEqual(8); + expect(screen.getAllByRole('menuitem')).toHaveLength(8); expect(screen.getByText('Lataa taulukko (csv)')).toBeTruthy(); expect(screen.getByText('Lataa taulukko (xlsx)')).toBeTruthy(); expect(screen.getByText('Foo')).toBeTruthy(); @@ -83,9 +84,9 @@ describe('burgerMenu, functional tests', () => { act(() => { screen.getByRole('button').click(); }); + const menuItem = await screen.findByText(Translations.toggleAccessibilityModeOn["fi"]); + fireEvent.click(menuItem); await waitFor(() => { - const menuItem = screen.getByText(Translations.toggleAccessibilityModeOn["fi"]); - fireEvent.click(menuItem); expect(mockToggleAccessibilityModeFunction).toHaveBeenCalledTimes(1); }); }); @@ -128,9 +129,7 @@ describe('burgerMenu, functional tests', () => { act(() => { screen.getByRole('button').click(); }); - act(() => { - fireEvent.keyDown(screen.getByRole('button'), { key: 'Escape' }); - }); + fireEvent.keyDown(screen.getByRole('button'), { key: 'Escape' }); expect(screen.queryByRole('menu')).toBeNull(); }); @@ -140,9 +139,7 @@ describe('burgerMenu, functional tests', () => { act(() => { screen.getByRole('button').click(); }); - act(() => { - fireEvent.keyDown(screen.getByRole('button'), { key: 'Tab' }); - }); + fireEvent.keyDown(screen.getByRole('button'), { key: 'Tab' }); expect(screen.queryByRole('menu')).toBeNull(); }); @@ -280,16 +277,12 @@ describe('burgerMenu, functional tests', () => { expect(screen.getByText('Item1').closest('button')?.getAttribute('tabIndex')).toBe('0'); expect(screen.getByText('Item2').closest('button')?.getAttribute('tabIndex')).toBe('-1'); }); - act(() => { - fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowDown' }); // window? - }); + fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowDown' }); // window? await waitFor(() => { expect(screen.getByText('Item1').closest('button')?.getAttribute('tabIndex')).toBe('-1'); expect(screen.getByText('Item2').closest('button')?.getAttribute('tabIndex')).toBe('0'); }); - act(() => { - fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowUp' }); // window? - }); + fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowUp' }); // window? await waitFor(() => { expect(screen.getByText('Item1').closest('button')?.getAttribute('tabIndex')).toBe('0'); expect(screen.getByText('Item2').closest('button')?.getAttribute('tabIndex')).toBe('-1'); @@ -306,16 +299,12 @@ describe('burgerMenu, functional tests', () => { expect(screen.getByText('Lataa taulukko (xlsx)').closest('button')?.getAttribute('tabIndex')).toBe('0'); expect(screen.getByText('Lataa taulukko (csv)').closest('button')?.getAttribute('tabIndex')).toBe('-1'); }); - act(() => { - fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowDown' }); - }); + fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowDown' }); await waitFor(() => { expect(screen.getByText('Lataa taulukko (xlsx)').closest('button')?.getAttribute('tabIndex')).toBe('-1'); expect(screen.getByText('Lataa taulukko (csv)').closest('button')?.getAttribute('tabIndex')).toBe('0'); }); - act(() => { - fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowDown' }); - }); + fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowDown' }); await waitFor(() => { expect(screen.getByText('Lataa taulukko (xlsx)').closest('button')?.getAttribute('tabIndex')).toBe('0'); expect(screen.getByText('Lataa taulukko (csv)').closest('button')?.getAttribute('tabIndex')).toBe('-1'); @@ -332,9 +321,7 @@ describe('burgerMenu, functional tests', () => { expect(screen.getByText('Lataa taulukko (xlsx)').closest('button')?.getAttribute('tabIndex')).toBe('0'); expect(screen.getByText('Lataa taulukko (csv)').closest('button')?.getAttribute('tabIndex')).toBe('-1'); }); - act(() => { - fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowUp' }); - }); + fireEvent.keyDown(screen.getByRole('button'), { key: 'ArrowUp' }); await waitFor(() => { expect(screen.getByText('Lataa taulukko (xlsx)').closest('button')?.getAttribute('tabIndex')).toBe('-1'); expect(screen.getByText('Lataa taulukko (csv)').closest('button')?.getAttribute('tabIndex')).toBe('0'); diff --git a/src/react/components/burgerMenu/menuItem/__snapshots__/menuItem.test.tsx.snap b/src/react/components/burgerMenu/menuItem/__snapshots__/menuItem.test.tsx.snap index e20db04..cbe5dc0 100644 --- a/src/react/components/burgerMenu/menuItem/__snapshots__/menuItem.test.tsx.snap +++ b/src/react/components/burgerMenu/menuItem/__snapshots__/menuItem.test.tsx.snap @@ -57,6 +57,7 @@ exports[`MenuItem, rendering tests should render 1`] = ` id="foo-menuitem--1" role="menuitem" tabindex="-1" + type="button" >