summaryrefslogtreecommitdiff
path: root/spec/frontend/environments/environment_terminal_button_spec.js
blob: ab9f370595f77557e22b5a2707e6c28b4f49a6dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { mountExtended } from 'helpers/vue_test_utils_helper';
import TerminalComponent from '~/environments/components/environment_terminal_button.vue';
import { __ } from '~/locale';

describe('Terminal Component', () => {
  let wrapper;
  const terminalPath = '/path';

  const mountWithProps = (props) => {
    wrapper = mountExtended(TerminalComponent, {
      propsData: props,
    });
  };

  beforeEach(() => {
    mountWithProps({ terminalPath });
  });

  it('should render a link to open a web terminal with the provided path', () => {
    const link = wrapper.findByRole('menuitem', { name: __('Terminal') });
    expect(link.attributes('href')).toBe(terminalPath);
  });

  it('should render a non-disabled button', () => {
    expect(wrapper.classes()).not.toContain('disabled');
  });
});