2019-10-28 10:09:48 -07:00
|
|
|
import { configure } from 'enzyme';
|
|
|
|
import Adapter from 'enzyme-adapter-react-16';
|
2019-11-02 02:27:36 -07:00
|
|
|
import { GlobalWithFetchMock } from 'jest-fetch-mock';
|
2021-03-23 15:55:52 -07:00
|
|
|
import 'mutationobserver-shim'; // Needed for CodeMirror.
|
2019-10-28 10:09:48 -07:00
|
|
|
import './globals';
|
|
|
|
|
|
|
|
configure({ adapter: new Adapter() });
|
2019-11-02 02:27:36 -07:00
|
|
|
const customGlobal: GlobalWithFetchMock = global as GlobalWithFetchMock;
|
|
|
|
customGlobal.fetch = require('jest-fetch-mock');
|
|
|
|
customGlobal.fetchMock = customGlobal.fetch;
|
2021-03-23 15:55:52 -07:00
|
|
|
|
|
|
|
// CodeMirror in the expression input requires this DOM API. When we upgrade react-scripts
|
|
|
|
// and the associated Jest deps, hopefully this won't be needed anymore.
|
|
|
|
document.getSelection = function() {
|
|
|
|
return {
|
|
|
|
addRange: function() {
|
|
|
|
return;
|
|
|
|
},
|
|
|
|
removeAllRanges: function() {
|
|
|
|
return;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|