diff --git a/package-lock.json b/package-lock.json index d133b572..21d3fbc3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,6 +59,7 @@ }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "jest-canvas-mock": "^2.5.2", "sass": "1.64.0" } }, @@ -6608,6 +6609,12 @@ "node": ">=4" } }, + "node_modules/cssfontparser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/cssfontparser/-/cssfontparser-1.2.1.tgz", + "integrity": "sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==", + "dev": true + }, "node_modules/cssnano": { "version": "5.1.15", "license": "MIT", @@ -10460,6 +10467,16 @@ } } }, + "node_modules/jest-canvas-mock": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz", + "integrity": "sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==", + "dev": true, + "dependencies": { + "cssfontparser": "^1.2.1", + "moo-color": "^1.0.2" + } + }, "node_modules/jest-changed-files": { "version": "27.5.1", "license": "MIT", @@ -13039,6 +13056,21 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/moo-color": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/moo-color/-/moo-color-1.0.3.tgz", + "integrity": "sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==", + "dev": true, + "dependencies": { + "color-name": "^1.1.4" + } + }, + "node_modules/moo-color/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/mouse-change": { "version": "1.4.0", "license": "MIT", diff --git a/package.json b/package.json index 08f873be..dbbc0697 100644 --- a/package.json +++ b/package.json @@ -58,12 +58,13 @@ }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "jest-canvas-mock": "^2.5.2", "sass": "1.64.0" }, "scripts": { "start": "npm-run-all --max-old-space-size=8192 -p watch-css start-js", "build": "GENERATE_SOURCEMAP=false && npm-run-all --max-old-space-size=10240 build-css build-js", - "test": "GENERATE_SOURCEMAP=false && react-scripts test --passWithNoTests", + "test": "react-scripts test --transformIgnorePatterns '!node_modules/(?!@devexpress|@fontsource|decode-uri-component|query-string)'", "eject": "react-scripts eject", "start-js": "react-scripts start", "build-js": "react-scripts --max-old-space-size=10240 build", diff --git a/src/helpers/Utils.test.js b/src/helpers/Utils.test.js index 3fa12c9f..8cff9123 100644 --- a/src/helpers/Utils.test.js +++ b/src/helpers/Utils.test.js @@ -1,7 +1,18 @@ import { availableDataVisibilityFilter } from "./Utils"; +import * as apolloDependency from './ApolloClient'; +import * as appDependency from '../App'; + // test for availableDataVisibilityFilter describe("availableDataVisibilityFilter", () => { + + + beforeEach(() => { + apolloDependency.fetchDataTypesForConcept= jest.fn(); + appDependency.store = {} + }); + + test("should return data data if data hrtCount has a count of at least 1", () => { const data = { hrtCount: 1,