// These polyfills are helpful for unit testing of pragmatic-drag-and-drop
// More info: https://atlassian.design/components/pragmatic-drag-and-drop/optional-packages/unit-testing/about
import '@atlaskit/pragmatic-drag-and-drop-unit-testing/dom-rect-polyfill'
import '@atlaskit/pragmatic-drag-and-drop-unit-testing/drag-event-polyfill'

import { TextDecoder, TextEncoder } from 'util'

global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder

global.ResizeObserver = jest.fn(() => ({
  observe: jest.fn(),
  unobserve: jest.fn(),
  disconnect: jest.fn(),
}))

// TODO remove this eventually
global['requestAnimationFrame'] = function requestAnimationFrame(callback) {
  setTimeout(callback, 0)

  return 0
}
