2021-10-04 14:12:46 -04:00
|
|
|
import { mountExtended } from 'helpers/vue_test_utils_helper';
|
2019-11-26 13:06:33 -05:00
|
|
|
import TerminalComponent from '~/environments/components/environment_terminal_button.vue';
|
2021-10-04 14:12:46 -04:00
|
|
|
import { __ } from '~/locale';
|
2019-11-26 13:06:33 -05:00
|
|
|
|
2021-10-04 14:12:46 -04:00
|
|
|
describe('Terminal Component', () => {
|
2019-11-26 13:06:33 -05:00
|
|
|
let wrapper;
|
|
|
|
const terminalPath = '/path';
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
const mountWithProps = (props) => {
|
2021-10-04 14:12:46 -04:00
|
|
|
wrapper = mountExtended(TerminalComponent, {
|
2019-11-26 13:06:33 -05:00
|
|
|
propsData: props,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
mountWithProps({ terminalPath });
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a link to open a web terminal with the provided path', () => {
|
2021-10-04 14:12:46 -04:00
|
|
|
const link = wrapper.findByRole('menuitem', { name: __('Terminal') });
|
|
|
|
expect(link.attributes('href')).toBe(terminalPath);
|
2019-11-26 13:06:33 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a non-disabled button', () => {
|
|
|
|
expect(wrapper.classes()).not.toContain('disabled');
|
|
|
|
});
|
|
|
|
});
|