File size: 633 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
// @flow
import Enzyme from "enzyme";
import Adapter from "enzyme-adapter-react-16";
Enzyme.configure({ adapter: new Adapter() });
// We rely on sort() being deterministic for tests, but it changed from QuickSort to TimSort
// in Node 12. This breaks tests, so we monkey-patch it.
import { sort } from "timsort";
// $FlowIgnore dirty hack
Array.prototype.sort = function (comparator) {
sort(this, comparator);
return this;
};
// Required in drag code, not working in JSDOM
Object.defineProperty(HTMLElement.prototype, "offsetParent", {
get() {
// $FlowIgnore[object-this-reference]
return this.parentNode;
}
});
|