Commit 9cdfdb0a authored by Emily Ring's avatar Emily Ring

Moved environments_folder_view_spec to jest test

Migrated environments_folder_view_spec.js in /ee/spec/
to change from karma testing to jest testing
parent 4ee32691
import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { environmentsList } from 'spec/environments/mock_data';
import { mount } from '@vue/test-utils';
import axios from '~/lib/utils/axios_utils';
import environmentsFolderViewComponent from '~/environments/folder/environments_folder_view.vue';
import MockAdapter from 'axios-mock-adapter';
import { environmentsList } from './mock_data';
import EnvironmentsFolderViewComponent from '~/environments/folder/environments_folder_view.vue';
describe('Environments Folder View', () => {
let Component;
let component;
let mock;
let wrapper;
const mockData = {
endpoint: 'environments.json',
......@@ -24,14 +22,11 @@ describe('Environments Folder View', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
Component = Vue.extend(environmentsFolderViewComponent);
});
afterEach(() => {
mock.restore();
component.$destroy();
wrapper.destroy();
});
describe('successful request', () => {
......@@ -53,15 +48,13 @@ describe('Environments Folder View', () => {
},
);
component = mountComponent(Component, mockData);
wrapper = mount(EnvironmentsFolderViewComponent, { propsData: mockData });
return axios.waitForAll();
});
describe('deploy boards', () => {
it('should render arrow to open deploy boards', done => {
setTimeout(() => {
expect(component.$el.querySelector('.folder-icon.ic-chevron-right')).not.toBeNull();
done();
}, 0);
it('should render arrow to open deploy boards', () => {
expect(wrapper.find('.folder-icon.ic-chevron-right').exists()).toBe(true);
});
});
});
......
......@@ -100,3 +100,39 @@ export const environment = {
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-10T15:55:58.778Z',
};
export const environmentsList = [
{
name: 'DEV',
size: 1,
id: 7,
state: 'available',
external_url: null,
environment_type: null,
last_deployment: null,
has_stop_action: false,
environment_path: '/root/review-app/environments/7',
stop_path: '/root/review-app/environments/7/stop',
created_at: '2017-01-31T10:53:46.894Z',
updated_at: '2017-01-31T10:53:46.894Z',
project_path: '/root/review-app',
rollout_status: {},
},
{
folderName: 'build',
size: 5,
id: 12,
name: 'build/update-README',
state: 'available',
external_url: null,
environment_type: 'build',
last_deployment: null,
has_stop_action: false,
environment_path: '/root/review-app/environments/12',
stop_path: '/root/review-app/environments/12/stop',
created_at: '2017-02-01T19:42:18.400Z',
updated_at: '2017-02-01T19:42:18.400Z',
project_path: '/root/review-app',
rollout_status: {},
},
];
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