diff options
Diffstat (limited to 'spec/frontend/ide/components/ide_spec.js')
-rw-r--r-- | spec/frontend/ide/components/ide_spec.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/frontend/ide/components/ide_spec.js b/spec/frontend/ide/components/ide_spec.js index a575f428a69..eb8f2a5e4ac 100644 --- a/spec/frontend/ide/components/ide_spec.js +++ b/spec/frontend/ide/components/ide_spec.js @@ -45,6 +45,13 @@ describe('WebIDE', () => { const callOnBeforeUnload = (e = {}) => window.onbeforeunload(e); + beforeAll(() => { + // HACK: Workaround readonly property in Jest + Object.defineProperty(window, 'onbeforeunload', { + writable: true, + }); + }); + beforeEach(() => { stubPerformanceWebAPI(); @@ -52,8 +59,6 @@ describe('WebIDE', () => { }); afterEach(() => { - wrapper.destroy(); - wrapper = null; window.onbeforeunload = null; }); @@ -66,7 +71,7 @@ describe('WebIDE', () => { }); }); - it('renders "New file" button in empty repo', async () => { + it('renders "New file" button in empty repo', () => { expect(wrapper.find('[title="New file"]').exists()).toBe(true); }); }); @@ -171,7 +176,7 @@ describe('WebIDE', () => { }); }); - it('when user cannot push code, shows alert', () => { + it('when user cannot push code, shows an alert', () => { store.state.links = { forkInfo: { ide_path: TEST_FORK_IDE_PATH, |