From 547144a565bde3b889742f96dc8e37f860510aa9 Mon Sep 17 00:00:00 2001 From: Kerry Date: Wed, 2 Mar 2022 13:05:50 +0100 Subject: [PATCH] Jest mock for svgr icons (#7941) * add svg mock Signed-off-by: Kerry Archibald * use same mock string as imageMock Signed-off-by: Kerry Archibald * newline Signed-off-by: Kerry Archibald --- __mocks__/svg.js | 2 ++ package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 __mocks__/svg.js diff --git a/__mocks__/svg.js b/__mocks__/svg.js new file mode 100644 index 0000000000..c2dc9d9aa7 --- /dev/null +++ b/__mocks__/svg.js @@ -0,0 +1,2 @@ +export const Icon = 'div'; +export default "image-file-stub"; diff --git a/package.json b/package.json index f2d9c60eed..957982c474 100644 --- a/package.json +++ b/package.json @@ -214,7 +214,8 @@ "/test/setupTests.js" ], "moduleNameMapper": { - "\\.(gif|png|svg|ttf|woff2)$": "/__mocks__/imageMock.js", + "\\.(gif|png|ttf|woff2)$": "/__mocks__/imageMock.js", + "\\.svg$": "/__mocks__/svg.js", "\\$webapp/i18n/languages.json": "/__mocks__/languages.json", "decoderWorker\\.min\\.js": "/__mocks__/empty.js", "decoderWorker\\.min\\.wasm": "/__mocks__/empty.js",