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 { ...@@ -28,11 +28,13 @@ export default {
if (lastOpenedFile) { if (lastOpenedFile) {
this.openPendingTab({ this.openPendingTab({
file: lastOpenedFile, file: lastOpenedFile,
}).then(changeViewer => { })
.then(changeViewer => {
if (changeViewer) { if (changeViewer) {
this.updateViewer('diff'); this.updateViewer('diff');
} }
}).catch((e) => { })
.catch(e => {
throw e; throw e;
}); });
} }
......
import Vue from 'vue'; import Vue from 'vue';
import store from '~/ide/stores'; import store from '~/ide/stores';
import service from '~/ide/services'; import service from '~/ide/services';
import router from '~/ide/ide_router';
import repoCommitSection from '~/ide/components/repo_commit_section.vue'; import repoCommitSection from '~/ide/components/repo_commit_section.vue';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { file, resetStore } from '../helpers'; import { file, resetStore } from '../helpers';
...@@ -59,6 +60,8 @@ describe('RepoCommitSection', () => { ...@@ -59,6 +60,8 @@ describe('RepoCommitSection', () => {
} }
beforeEach(done => { beforeEach(done => {
spyOn(router, 'push');
vm = createComponent(); vm = createComponent();
spyOn(service, 'getTreeData').and.returnValue( spyOn(service, 'getTreeData').and.returnValue(
...@@ -167,4 +170,11 @@ describe('RepoCommitSection', () => { ...@@ -167,4 +170,11 @@ describe('RepoCommitSection', () => {
done(); 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