<commit_before>import { Action, KeyCombo, shortcutJS } from '../src'
import { getMockedEvent } from './utils'

/**
 * Mock window
 */
interface MockWindow extends Window {
  addEventListener: jest.Mock<{}> & typeof window.addEventListener
  removeEventListener: jest.Mock<{}> & typeof window.removeEventListener
}
function getMockWindow() {
  window.addEventListener = jest.fn()
  window.removeEventListener = jest.fn()
  return window as MockWindow
}

/**
 * Actual test suite
 */
describe('shortcutJS', () => {
  let mockWindow = getMockWindow()

  afterEach(() => {
    shortcutJS.reset()

    mockWindow.addEventListener.mockClear()
    mockWindow.removeEventListener.mockClear()
  })

  describe('init', () => {
    it('sets keydown and keyup event listeners', () => {
      shortcutJS.init()
      expect(mockWindow.addEventListener).toHaveBeenCalledTimes(2)
    })
<commit_msg>test(global): change window for global variable<commit_after>import { Action, KeyCombo, shortcutJS } from '../src'
import { getMockedEvent } from './utils'

/**
 * Mock window
 */
interface MockWindow extends Window {
  addEventListener: jest.Mock<{}> & typeof window.addEventListener
  removeEventListener: jest.Mock<{}> & typeof window.removeEventListener
}
function getMockWindow() {
  let myGlobal = global as any
  myGlobal.addEventListener = jest.fn()
  myGlobal.removeEventListener = jest.fn()
  return myGlobal
}

/**
 * Actual test suite
 */
describe('shortcutJS', () => {
  let mockWindow = getMockWindow()

  beforeEach(() => {
    shortcutJS.reset()

    mockWindow.addEventListener.mockClear()
    mockWindow.removeEventListener.mockClear()
  })

  describe('init', () => {
    it('sets keydown and keyup event listeners', () => {
      shortcutJS.init()
      expect(mockWindow.addEventListener).toHaveBeenCalledTimes(2)
    })

{'fraction_non_alphanumeric': 0.13581599123767799, 'fraction_numerical': 0.001095290251916758, 'mean_word_length': 4.190340909090909, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4582112', 'n_tokens_mistral': 520, 'n_tokens_neox': 511, 'n_words': 116}