import Store from '~/issues/show/stores'; import updateDescription from '~/issues/show/utils/update_description'; jest.mock('~/issues/show/utils/update_description'); describe('Store', () => { let store; beforeEach(() => { store = new Store({ descriptionHtml: '

This is a description

', }); }); describe('updateState', () => { beforeEach(() => { document.body.innerHTML = `
One
Two
`; }); afterEach(() => { document.getElementsByTagName('html')[0].innerHTML = ''; }); it('calls updateDetailsState', () => { store.updateState({ description: '' }); expect(updateDescription).toHaveBeenCalledTimes(1); }); }); });