Commit d995eb28 authored by Phil Hughes's avatar Phil Hughes

spec fixes

added spec to check for last opened file
parent 382546e0
......@@ -28,11 +28,13 @@ export default {
if (lastOpenedFile) {
this.openPendingTab({
file: lastOpenedFile,
}).then(changeViewer => {
})
.then(changeViewer => {
if (changeViewer) {
this.updateViewer('diff');
}
}).catch((e) => {
})
.catch(e => {
throw e;
});
}
......
import Vue from 'vue';
import store from '~/ide/stores';
import service from '~/ide/services';
import router from '~/ide/ide_router';
import repoCommitSection from '~/ide/components/repo_commit_section.vue';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { file, resetStore } from '../helpers';
......@@ -59,6 +60,8 @@ describe('RepoCommitSection', () => {
}
beforeEach(done => {
spyOn(router, 'push');
vm = createComponent();
spyOn(service, 'getTreeData').and.returnValue(
......@@ -167,4 +170,11 @@ describe('RepoCommitSection', () => {
done();
});
});
describe('mounted', () => {
it('opens last opened file', () => {
expect(store.state.openFiles.length).toBe(1);
expect(store.state.openFiles[0].pending).toBe(true);
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment