From 373d35a52252c18f8e4cf9cc1f030e55559b5f20 Mon Sep 17 00:00:00 2001 From: jabahum Date: Thu, 18 Jan 2024 16:58:48 +0300 Subject: [PATCH] fix file test error --- file-transformer.js | 9 +++++++++ jest.config.js | 1 + package.json | 1 + .../src/assets/thumb-16.png | Bin 428 -> 0 bytes .../src/assets/thumb-32.png | Bin 1045 -> 0 bytes .../src/assets/{thumb-96.png => thumb.png} | Bin .../fingerprint-capture/thumbprint.component.tsx | 5 +++-- yarn.lock | 8 ++++++++ 8 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 file-transformer.js delete mode 100644 packages/esm-patient-registration-app/src/assets/thumb-16.png delete mode 100644 packages/esm-patient-registration-app/src/assets/thumb-32.png rename packages/esm-patient-registration-app/src/assets/{thumb-96.png => thumb.png} (100%) diff --git a/file-transformer.js b/file-transformer.js new file mode 100644 index 0000000..3ea1ef2 --- /dev/null +++ b/file-transformer.js @@ -0,0 +1,9 @@ +const path = require('path'); + +module.exports = { + process(sourceText, sourcePath, options) { + return { + code: `module.exports = ${JSON.stringify(path.basename(sourcePath))};`, + }; + }, +}; diff --git a/jest.config.js b/jest.config.js index 991ee65..da3c3f6 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,6 +7,7 @@ const path = require('path'); module.exports = { transform: { '^.+\\.(j|t)sx?$': '@swc/jest', + '^.+\\.png$': path.resolve(__dirname, 'file-transformer.js'), }, transformIgnorePatterns: ['/node_modules/(?!@openmrs)'], moduleNameMapper: { diff --git a/package.json b/package.json index 650246e..2b53ca2 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "jest": "^28.1.0", "jest-cli": "^28.1.0", "jest-environment-jsdom": "^28.1.0", + "jest-transform-stub": "^2.0.0", "lerna": "^3.20.2", "openmrs": "next", "prettier": "^2.4.1", diff --git a/packages/esm-patient-registration-app/src/assets/thumb-16.png b/packages/esm-patient-registration-app/src/assets/thumb-16.png deleted file mode 100644 index ca2dc5f438725af2e7a09bced66e64fdb510b7f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 428 zcmV;d0aN~oP)omh(*j|DYp-YG>PS?s5d#gMfaC5pBH~0za(Fd zos6<|+)TVUn`nt`Z0$T6Yf3iKT8r;k;B>4rzSgV2bY8v^o_CyE;?;cDlXIoJg@$^d zPBiJOxPV9afQLBMm1`i0N0K;_8`~J)WsECPv!}bjlWbn8D9PV(2M^+3OtHFosGD5a zmvz0Aov%L2pUD1KtgZC^UIhxZ%9U^<%knB?+#OX__-H?J!(hm@m2Ir$S1T3!2Y&#T W07}T@-{Xh?0000VP)p&$Q^qpw#Z-*yL9n2pry?W zUjakfgK-_O1o#*D8E6DL0|j6NFu{Kh0$p8ebng{~3>r0|0IUK20bZ8ScDEg@gXC^F>~G0_X;8 z1b$VM^UV`siqXJ9pi7sY}g@T$HtSF=Rey#(}j?+2a@t-S&a zl6GjaP0UyN!1pGXqJlJO+w&4j5n;9*xCHc<&M5_G2EKD&(0)BnfOmmi&JVh|LCNm{ z-T;m!YMhifVL{(nlHB$og$aknFnvEyfX{#p&M)cJ&q}PIM#2wDXmOOV!O$#v<{4nJ zeu7CXc(jR@gy2;VPj;Tgu>8B;k)AJ_H?sEMumB%9vQRqT7X5Y+px_|GCsF}=bd&&( z7`l1q#{p+LN`N(vTFflH=6P97vQ7?Y@k&%tFy{Q zUk|?RjdmIZ_1d>pRUX#1(FGmx-&Psl>0@QL8jDDHvX-WFtli8WJ$a(*Lwt-x9r(og zaMvc-N$vA8Pf2S=wVG(wzGLi!nr*p%^qug4|5Gef6RUupz@yU0Ex~!t*kWikY4ZkC z@7d%*k~W<~Wm>0@adv$z?}8FK+n`?7o)i67)C`SD{YMWU5B%hrH!JaaDnQ&U!YfP= z_6?QBOZWv~ni(@5tg#k*B1DI^2jg-K(9Xdiq99`Yg3ac)_Kf8XYcBo=ky$K{!dt;( P00000NkvXXu0mjf%0c9O diff --git a/packages/esm-patient-registration-app/src/assets/thumb-96.png b/packages/esm-patient-registration-app/src/assets/thumb.png similarity index 100% rename from packages/esm-patient-registration-app/src/assets/thumb-96.png rename to packages/esm-patient-registration-app/src/assets/thumb.png diff --git a/packages/esm-patient-registration-app/src/patient-registration/input/custom-input/fingerprint-capture/thumbprint.component.tsx b/packages/esm-patient-registration-app/src/patient-registration/input/custom-input/fingerprint-capture/thumbprint.component.tsx index ef90adb..7d45190 100644 --- a/packages/esm-patient-registration-app/src/patient-registration/input/custom-input/fingerprint-capture/thumbprint.component.tsx +++ b/packages/esm-patient-registration-app/src/patient-registration/input/custom-input/fingerprint-capture/thumbprint.component.tsx @@ -1,6 +1,7 @@ +/* eslint-disable jsx-a11y/no-static-element-interactions */ import React from 'react'; import styles from './fingerprint-capture.scss'; -import thumb96 from '../../../../assets/thumb-96.png'; +import thumb96 from '../../../../assets/thumb.png'; interface ThumbPrintProps { data: string; @@ -10,7 +11,7 @@ interface ThumbPrintProps { const ThumbPrint: React.FC = ({ data, onClick, isActive }) => (
onClick(data)}> - {'photo'} + {'thumb'} {data &&

Scan {data}

}
); diff --git a/yarn.lock b/yarn.lock index e4f5cda..073ade5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5004,6 +5004,7 @@ __metadata: jest: ^28.1.0 jest-cli: ^28.1.0 jest-environment-jsdom: ^28.1.0 + jest-transform-stub: ^2.0.0 lerna: ^3.20.2 openmrs: next prettier: ^2.4.1 @@ -12893,6 +12894,13 @@ __metadata: languageName: node linkType: hard +"jest-transform-stub@npm:^2.0.0": + version: 2.0.0 + resolution: "jest-transform-stub@npm:2.0.0" + checksum: c46134257e5fb047f5952e4a4a1339925dd009da15aa8d3310ba1d3e4d22266ed6c675cd18e58c9d5ca2246718d6cc8ff00ea6a4b6f3b2a6b285b6426f6ae8fe + languageName: node + linkType: hard + "jest-util@npm:^28.1.3": version: 28.1.3 resolution: "jest-util@npm:28.1.3"