debian-mirror-gitlab/spec/frontend/ide/components/ide_tree_spec.js

36 lines
923 B
JavaScript
Raw Normal View History

2018-10-15 14:42:47 +05:30
import Vue from 'vue';
import IdeTree from '~/ide/components/ide_tree.vue';
2020-10-24 23:57:45 +05:30
import { createStore } from '~/ide/stores';
2018-10-15 14:42:47 +05:30
import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
2020-10-24 23:57:45 +05:30
import { file } from '../helpers';
2018-10-15 14:42:47 +05:30
import { projectData } from '../mock_data';
describe('IdeRepoTree', () => {
2020-10-24 23:57:45 +05:30
let store;
2018-10-15 14:42:47 +05:30
let vm;
beforeEach(() => {
2020-10-24 23:57:45 +05:30
store = createStore();
2018-10-15 14:42:47 +05:30
const IdeRepoTree = Vue.extend(IdeTree);
store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master';
2020-05-24 23:13:21 +05:30
store.state.projects.abcproject = { ...projectData };
2018-10-15 14:42:47 +05:30
Vue.set(store.state.trees, 'abcproject/master', {
tree: [file('fileName')],
loading: false,
});
vm = createComponentWithStore(IdeRepoTree, store).$mount();
});
afterEach(() => {
vm.$destroy();
});
it('renders list of files', () => {
expect(vm.$el.textContent).toContain('fileName');
});
});