import initImageDiffHelper from '~/image_diff/helpers/init_image_diff'; import ImageDiff from '~/image_diff/image_diff'; import ReplacedImageDiff from '~/image_diff/replaced_image_diff'; describe('initImageDiff', () => { let glCache; let fileEl; beforeEach(() => { window.gl = window.gl || (window.gl = {}); glCache = window.gl; fileEl = document.createElement('div'); fileEl.innerHTML = `
`; jest.spyOn(ReplacedImageDiff.prototype, 'init').mockImplementation(() => {}); jest.spyOn(ImageDiff.prototype, 'init').mockImplementation(() => {}); }); afterEach(() => { window.gl = glCache; }); it('should initialize ImageDiff if js-single-image', () => { const diffFileEl = fileEl.querySelector('.diff-file'); diffFileEl.innerHTML = `