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

48 lines
1.4 KiB
JavaScript
Raw Normal View History

require('~/environments/components/environment_rollback');
2016-12-29 16:42:48 -05:00
describe('Rollback Component', () => {
preloadFixtures('static/environments/element.html.raw');
const retryURL = 'https://gitlab.com/retry';
beforeEach(() => {
loadFixtures('static/environments/element.html.raw');
});
2016-12-08 07:06:49 -05:00
it('Should link to the provided retryUrl', () => {
const component = new window.gl.environmentsList.RollbackComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
2016-12-08 06:54:08 -05:00
retryUrl: retryURL,
isLastDeployment: true,
},
});
expect(component.$el.getAttribute('href')).toEqual(retryURL);
});
2016-12-08 07:06:49 -05:00
it('Should render Re-deploy label when isLastDeployment is true', () => {
const component = new window.gl.environmentsList.RollbackComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
2016-12-08 06:54:08 -05:00
retryUrl: retryURL,
isLastDeployment: true,
},
});
expect(component.$el.querySelector('span').textContent).toContain('Re-deploy');
});
2016-12-08 07:06:49 -05:00
it('Should render Rollback label when isLastDeployment is false', () => {
const component = new window.gl.environmentsList.RollbackComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
2016-12-08 06:54:08 -05:00
retryUrl: retryURL,
isLastDeployment: false,
},
});
expect(component.$el.querySelector('span').textContent).toContain('Rollback');
});
});