diff options
Diffstat (limited to 'spec/frontend/ide/stores/utils_spec.js')
-rw-r--r-- | spec/frontend/ide/stores/utils_spec.js | 93 |
1 files changed, 2 insertions, 91 deletions
diff --git a/spec/frontend/ide/stores/utils_spec.js b/spec/frontend/ide/stores/utils_spec.js index b87f6c1f05a..d1eb4304c79 100644 --- a/spec/frontend/ide/stores/utils_spec.js +++ b/spec/frontend/ide/stores/utils_spec.js @@ -28,61 +28,6 @@ describe('Multi-file store utils', () => { }); }); - describe('findIndexOfFile', () => { - let localState; - - beforeEach(() => { - localState = [ - { - path: '1', - }, - { - path: '2', - }, - ]; - }); - - it('finds in the index of an entry by path', () => { - const index = utils.findIndexOfFile(localState, { - path: '2', - }); - - expect(index).toBe(1); - }); - }); - - describe('findEntry', () => { - let localState; - - beforeEach(() => { - localState = { - tree: [ - { - type: 'tree', - name: 'test', - }, - { - type: 'blob', - name: 'file', - }, - ], - }; - }); - - it('returns an entry found by name', () => { - const foundEntry = utils.findEntry(localState.tree, 'tree', 'test'); - - expect(foundEntry.type).toBe('tree'); - expect(foundEntry.name).toBe('test'); - }); - - it('returns undefined when no entry found', () => { - const foundEntry = utils.findEntry(localState.tree, 'blob', 'test'); - - expect(foundEntry).toBeUndefined(); - }); - }); - describe('createCommitPayload', () => { it('returns API payload', () => { const state = { @@ -101,12 +46,11 @@ describe('Multi-file store utils', () => { path: 'added', tempFile: true, content: 'new file content', - base64: true, + rawPath: 'data:image/png;base64,abc', lastCommitSha: '123456789', }, { ...file('deletedFile'), path: 'deletedFile', deleted: true }, { ...file('renamedFile'), path: 'renamedFile', prevPath: 'prevPath' }, - { ...file('replacingFile'), path: 'replacingFile', replaces: true }, ], currentBranchId: 'master', }; @@ -154,14 +98,6 @@ describe('Multi-file store utils', () => { last_commit_id: undefined, previous_path: 'prevPath', }, - { - action: commitActionTypes.update, - file_path: 'replacingFile', - content: undefined, - encoding: 'text', - last_commit_id: undefined, - previous_path: undefined, - }, ], start_sha: undefined, }); @@ -181,7 +117,7 @@ describe('Multi-file store utils', () => { path: 'added', tempFile: true, content: 'new file content', - base64: true, + rawPath: 'data:image/png;base64,abc', lastCommitSha: '123456789', }, ], @@ -661,31 +597,6 @@ describe('Multi-file store utils', () => { }); }); - describe('addFinalNewlineIfNeeded', () => { - it('adds a newline if it doesnt already exist', () => { - [ - { - input: 'some text', - output: 'some text\n', - }, - { - input: 'some text\n', - output: 'some text\n', - }, - { - input: 'some text\n\n', - output: 'some text\n\n', - }, - { - input: 'some\n text', - output: 'some\n text\n', - }, - ].forEach(({ input, output }) => { - expect(utils.addFinalNewlineIfNeeded(input)).toEqual(output); - }); - }); - }); - describe('extractMarkdownImagesFromEntries', () => { let mdFile; let entries; |