diff options
Diffstat (limited to 'spec/frontend/snippet/snippet_bundle_spec.js')
-rw-r--r-- | spec/frontend/snippet/snippet_bundle_spec.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/frontend/snippet/snippet_bundle_spec.js b/spec/frontend/snippet/snippet_bundle_spec.js index ad69a91fe89..208d2fea804 100644 --- a/spec/frontend/snippet/snippet_bundle_spec.js +++ b/spec/frontend/snippet/snippet_bundle_spec.js @@ -15,11 +15,13 @@ describe('Snippet editor', () => { const updatedMockContent = 'New Foo Bar'; const mockEditor = { - createInstance: jest.fn(), updateModelLanguage: jest.fn(), getValue: jest.fn().mockReturnValueOnce(updatedMockContent), }; - Editor.mockImplementation(() => mockEditor); + const createInstance = jest.fn().mockImplementation(() => ({ ...mockEditor })); + Editor.mockImplementation(() => ({ + createInstance, + })); function setUpFixture(name, content) { setHTMLFixture(` @@ -56,7 +58,7 @@ describe('Snippet editor', () => { }); it('correctly initializes Editor', () => { - expect(mockEditor.createInstance).toHaveBeenCalledWith({ + expect(createInstance).toHaveBeenCalledWith({ el: editorEl, blobPath: mockName, blobContent: mockContent, |