Commit f2b6ac83 authored by Filipa Lacerda's avatar Filipa Lacerda

Fix broken tests

parent f047c4f8
const Vue = require('vue'); const Vue = require('vue');
const DeployBoardComponent = require('~/environments/components/deploy_board_component'); const DeployBoard = require('~/environments/components/deploy_board_component');
const Service = require('~/environments/services/environments_service'); const Service = require('~/environments/services/environments_service');
const { deployBoardMockData } = require('./mock_data'); const { deployBoardMockData } = require('./mock_data');
describe('Deploy Board', () => { describe('Deploy Board', () => {
preloadFixtures('static/environments/element.html.raw'); let DeployBoardComponent;
beforeEach(() => { beforeEach(() => {
loadFixtures('static/environments/element.html.raw'); DeployBoardComponent = Vue.extend(DeployBoard);
}); });
describe('successfull request', () => { describe('successfull request', () => {
...@@ -25,14 +25,13 @@ describe('Deploy Board', () => { ...@@ -25,14 +25,13 @@ describe('Deploy Board', () => {
this.service = new Service('environments'); this.service = new Service('environments');
component = new DeployBoardComponent({ component = new DeployBoardComponent({
el: document.querySelector('.test-dom-element'),
propsData: { propsData: {
store: {}, store: {},
service: this.service, service: this.service,
deployBoardData: deployBoardMockData, deployBoardData: deployBoardMockData,
environmentID: 1, environmentID: 1,
}, },
}); }).$mount();
}); });
afterEach(() => { afterEach(() => {
...@@ -92,14 +91,13 @@ describe('Deploy Board', () => { ...@@ -92,14 +91,13 @@ describe('Deploy Board', () => {
this.service = new Service('environments'); this.service = new Service('environments');
component = new DeployBoardComponent({ component = new DeployBoardComponent({
el: document.querySelector('.test-dom-element'),
propsData: { propsData: {
store: {}, store: {},
service: this.service, service: this.service,
deployBoardData: {}, deployBoardData: {},
environmentID: 1, environmentID: 1,
}, },
}); }).$mount();
}); });
afterEach(() => { afterEach(() => {
......
require('vue'); const Vue = require('vue');
const DeployBoardInstanceComponent = require('~/environments/components/deploy_board_instance_component'); const DeployBoardInstance = require('~/environments/components/deploy_board_instance_component');
describe('Deploy Board Instance', () => { describe('Deploy Board Instance', () => {
preloadFixtures('static/environments/element.html.raw'); let DeployBoardInstanceComponent;
beforeEach(() => { beforeEach(() => {
loadFixtures('static/environments/element.html.raw'); DeployBoardInstanceComponent = Vue.extend(DeployBoardInstance);
}); });
it('should render a div with the correct css status and tooltip data', () => { it('should render a div with the correct css status and tooltip data', () => {
const component = new DeployBoardInstanceComponent({ const component = new DeployBoardInstanceComponent({
el: document.querySelector('.test-dom-element'),
propsData: { propsData: {
status: 'ready', status: 'ready',
tooltipText: 'This is a pod', tooltipText: 'This is a pod',
}, },
}); }).$mount();
expect(component.$el.classList.contains('deploy-board-instance-ready')).toBe(true); expect(component.$el.classList.contains('deploy-board-instance-ready')).toBe(true);
expect(component.$el.getAttribute('data-title')).toEqual('This is a pod'); expect(component.$el.getAttribute('data-title')).toEqual('This is a pod');
...@@ -23,11 +22,10 @@ describe('Deploy Board Instance', () => { ...@@ -23,11 +22,10 @@ describe('Deploy Board Instance', () => {
it('should render a div without tooltip data', () => { it('should render a div without tooltip data', () => {
const component = new DeployBoardInstanceComponent({ const component = new DeployBoardInstanceComponent({
el: document.querySelector('.test-dom-element'),
propsData: { propsData: {
status: 'deploying', status: 'deploying',
}, },
}); }).$mount();
expect(component.$el.classList.contains('deploy-board-instance-deploying')).toBe(true); expect(component.$el.classList.contains('deploy-board-instance-deploying')).toBe(true);
expect(component.$el.getAttribute('data-title')).toEqual(''); expect(component.$el.getAttribute('data-title')).toEqual('');
......
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