From 9b3fc8686bf56eca2f69f80b4f02e3ee4e281b58 Mon Sep 17 00:00:00 2001 From: Magnus Revheim Martinsen Date: Thu, 2 Feb 2023 14:35:48 +0100 Subject: [PATCH] fix(help text): add title to helptext tests (#126) * add title to helptext test * add mock svg for SvgIcon test --- jest.config.js | 1 + packages/react/src/components/HelpText/HelpText.test.tsx | 9 ++++++++- test/__mocks__/svg.ts | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/__mocks__/svg.ts diff --git a/jest.config.js b/jest.config.js index bb2f16c0b4..16bd450b9b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,6 +3,7 @@ module.exports = { moduleNameMapper: { '.(css|less|scss)$': 'identity-obj-proxy', + '\\.svg$': '/test/__mocks__/svg.ts', }, preset: 'ts-jest', testEnvironment: 'jsdom', diff --git a/packages/react/src/components/HelpText/HelpText.test.tsx b/packages/react/src/components/HelpText/HelpText.test.tsx index 89d73fcabb..8edb10382f 100644 --- a/packages/react/src/components/HelpText/HelpText.test.tsx +++ b/packages/react/src/components/HelpText/HelpText.test.tsx @@ -9,7 +9,14 @@ const render = (props: Partial = {}) => { const allProps = { ...props, }; - renderRtl(Help); + renderRtl( + + Help + , + ); }; const user = userEvent.setup(); diff --git a/test/__mocks__/svg.ts b/test/__mocks__/svg.ts new file mode 100644 index 0000000000..ffe2050a02 --- /dev/null +++ b/test/__mocks__/svg.ts @@ -0,0 +1,2 @@ +export default 'SvgrURL'; +export const ReactComponent = 'div';