feat(tests): add canvas mocks, needed for favico.js

This commit is contained in:
Łukasz Mierzwa
2018-08-30 22:11:21 +01:00
parent 2858e54663
commit 95de9e3cf9
3 changed files with 10 additions and 0 deletions

6
ui/package-lock.json generated
View File

@@ -6506,6 +6506,12 @@
}
}
},
"jest-canvas-mock": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/jest-canvas-mock/-/jest-canvas-mock-1.1.0.tgz",
"integrity": "sha512-D2VoKl+L6r9VpqTPygXKvIOQ1aou7gz3PvstlWDZqPT7EVYcSz0Nj+yjJ9G+Y9EqJd2X95f3dzcmmXb2dvQ1DQ==",
"dev": true
},
"jest-changed-files": {
"version": "20.0.3",
"resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-20.0.3.tgz",

View File

@@ -55,6 +55,7 @@
"enzyme-adapter-react-16": "1.3.0",
"enzyme-to-json": "3.3.4",
"eslint-plugin-react": "7.11.1",
"jest-canvas-mock": "1.1.0",
"jest-fetch-mock": "1.6.5",
"jest-localstorage-mock": "2.2.0",
"jest-mock-console": "0.4.0",

View File

@@ -12,6 +12,9 @@ mockConsole(["error", "warn", "info", "log", "trace"]);
// localStorage is used for Settings store
require("jest-localstorage-mock");
// favico.js needs canvas
require("jest-canvas-mock");
// fetch is used in multiple places to interact with Go backend
// or upstream Alertmanager API
global.fetch = require("jest-fetch-mock");