2021-11-18 22:05:49 +05:30
|
|
|
import { mountExtended } from 'helpers/vue_test_utils_helper';
|
2020-01-01 13:55:28 +05:30
|
|
|
import TerminalComponent from '~/environments/components/environment_terminal_button.vue';
|
2021-11-18 22:05:49 +05:30
|
|
|
import { __ } from '~/locale';
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
describe('Terminal Component', () => {
|
2020-01-01 13:55:28 +05:30
|
|
|
let wrapper;
|
|
|
|
const terminalPath = '/path';
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
const mountWithProps = (props) => {
|
2021-11-18 22:05:49 +05:30
|
|
|
wrapper = mountExtended(TerminalComponent, {
|
2020-01-01 13:55:28 +05:30
|
|
|
propsData: props,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
mountWithProps({ terminalPath });
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a link to open a web terminal with the provided path', () => {
|
2021-11-18 22:05:49 +05:30
|
|
|
const link = wrapper.findByRole('menuitem', { name: __('Terminal') });
|
|
|
|
expect(link.attributes('href')).toBe(terminalPath);
|
2020-01-01 13:55:28 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a non-disabled button', () => {
|
|
|
|
expect(wrapper.classes()).not.toContain('disabled');
|
|
|
|
});
|
|
|
|
});
|