gitlab-org--gitlab-foss/spec/javascripts/environments/environment_rollback_spec.js

36 lines
1 KiB
JavaScript
Raw Normal View History

import Vue from 'vue';
2017-04-20 07:48:54 -04:00
import rollbackComp from '~/environments/components/environment_rollback.vue';
2016-12-29 16:42:48 -05:00
describe('Rollback Component', () => {
const retryURL = 'https://gitlab.com/retry';
let RollbackComponent;
beforeEach(() => {
RollbackComponent = Vue.extend(rollbackComp);
});
it('Should render Re-deploy label when isLastDeployment is true', () => {
2017-02-09 06:52:22 -05:00
const component = new RollbackComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
2016-12-08 06:54:08 -05:00
retryUrl: retryURL,
isLastDeployment: true,
},
}).$mount();
expect(component.$el.querySelector('span').textContent).toContain('Re-deploy');
});
it('Should render Rollback label when isLastDeployment is false', () => {
2017-02-09 06:52:22 -05:00
const component = new RollbackComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
2016-12-08 06:54:08 -05:00
retryUrl: retryURL,
isLastDeployment: false,
},
}).$mount();
expect(component.$el.querySelector('span').textContent).toContain('Rollback');
});
});