1 Star 0 Fork 0

jia/react-admin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test-setup.js 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
Matheus Wichman 提交于 2020-02-28 00:23 . Remove enzyme setup
require('raf/polyfill');
/**
* As jsDom do not support mutationobserver and
* quill requires mutationobserver, thus a shim is needed
*/
require('mutationobserver-shim');
/**
* Mock PopperJS
*
* When using mount(), material-ui calls Popper.js, which is not compatible with JSDom
* And causes UnhandledPromiseRejectionWarning: TypeError: document.createRange is not a function
*
* @see https://github.com/FezVrasta/popper.js/issues/478
*/
jest.mock('popper.js', () => {
class Popper {
constructor() {
return {
destroy: () => {},
scheduleUpdate: () => {},
update: () => {},
};
}
}
Popper.placements = [
'auto',
'auto-end',
'auto-start',
'bottom',
'bottom-end',
'bottom-start',
'left',
'left-end',
'left-start',
'right',
'right-end',
'right-start',
'top',
'top-end',
'top-start',
];
return Popper;
});
// Ignore warnings about act()
// See https://github.com/testing-library/react-testing-library/issues/281,
// https://github.com/facebook/react/issues/14769
const originalError = console.error;
jest.spyOn(console, 'error').mockImplementation((...args) => {
if (/Warning.*not wrapped in act/.test(args[0])) {
return;
}
originalError.call(console, ...args);
});
/**
* Mock fetch objects Response, Request and Headers
*/
const { Response, Headers, Request } = require('whatwg-fetch');
global.Response = Response;
global.Headers = Headers;
global.Request = Request;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jia-code/react-admin.git
[email protected]:jia-code/react-admin.git
jia-code
react-admin
react-admin
master

搜索帮助