diff options
Diffstat (limited to 'spec/frontend/snippets/components/snippet_blob_edit_spec.js')
-rw-r--r-- | spec/frontend/snippets/components/snippet_blob_edit_spec.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/frontend/snippets/components/snippet_blob_edit_spec.js b/spec/frontend/snippets/components/snippet_blob_edit_spec.js index 188f9ae5cf1..fc4da46d722 100644 --- a/spec/frontend/snippets/components/snippet_blob_edit_spec.js +++ b/spec/frontend/snippets/components/snippet_blob_edit_spec.js @@ -17,6 +17,7 @@ const TEST_PATH = 'foo/bar/test.md'; const TEST_RAW_PATH = '/gitlab/raw/path/to/blob/7'; const TEST_FULL_PATH = joinPaths(TEST_HOST, TEST_RAW_PATH); const TEST_CONTENT = 'Lorem ipsum dolar sit amet,\nconsectetur adipiscing elit.'; +const TEST_JSON_CONTENT = '{"abc":"lorem ipsum"}'; const TEST_BLOB = { id: TEST_ID, @@ -66,7 +67,7 @@ describe('Snippet Blob Edit component', () => { }); describe('with not loaded blob', () => { - beforeEach(async () => { + beforeEach(() => { createComponent(); }); @@ -100,6 +101,20 @@ describe('Snippet Blob Edit component', () => { }); }); + describe('with unloaded blob and JSON content', () => { + beforeEach(() => { + axiosMock.onGet(TEST_FULL_PATH).reply(200, TEST_JSON_CONTENT); + createComponent(); + }); + + // This checks against this issue https://gitlab.com/gitlab-org/gitlab/-/issues/241199 + it('emits raw content', async () => { + await waitForPromises(); + + expect(getLastUpdatedArgs()).toEqual({ content: TEST_JSON_CONTENT }); + }); + }); + describe('with error', () => { beforeEach(() => { axiosMock.reset(); |