2018-03-20 10:12:48 -04:00
|
|
|
import Vue from 'vue';
|
2018-04-17 11:27:46 -04:00
|
|
|
import IdeTree from '~/ide/components/ide_tree.vue';
|
2018-04-17 12:02:48 -04:00
|
|
|
import store from '~/ide/stores';
|
|
|
|
import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
|
|
|
|
import { resetStore, file } from '../helpers';
|
|
|
|
import { projectData } from '../mock_data';
|
2018-03-20 10:12:48 -04:00
|
|
|
|
|
|
|
describe('IdeRepoTree', () => {
|
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2018-04-17 11:27:46 -04:00
|
|
|
const IdeRepoTree = Vue.extend(IdeTree);
|
2018-03-20 10:12:48 -04:00
|
|
|
|
2018-04-17 12:02:48 -04:00
|
|
|
store.state.currentProjectId = 'abcproject';
|
|
|
|
store.state.currentBranchId = 'master';
|
|
|
|
store.state.projects.abcproject = Object.assign({}, projectData);
|
|
|
|
Vue.set(store.state.trees, 'abcproject/master', {
|
|
|
|
tree: [file('fileName')],
|
2018-03-20 10:12:48 -04:00
|
|
|
loading: false,
|
|
|
|
});
|
2018-04-17 12:02:48 -04:00
|
|
|
|
|
|
|
vm = createComponentWithStore(IdeRepoTree, store).$mount();
|
2018-03-20 10:12:48 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
|
2018-04-17 12:02:48 -04:00
|
|
|
resetStore(vm.$store);
|
2018-03-20 10:12:48 -04:00
|
|
|
});
|
|
|
|
|
2018-04-17 12:02:48 -04:00
|
|
|
it('renders list of files', () => {
|
|
|
|
expect(vm.$el.textContent).toContain('fileName');
|
|
|
|
});
|
2018-03-20 10:12:48 -04:00
|
|
|
});
|