blob: c3df187e1c5a822477ce861d2d6110fe742340a5 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import { GlButton, GlEmptyState } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import TracingEmptyState from '~/tracing/components/tracing_empty_state.vue';
describe('TracingEmptyState', () => {
let wrapper;
const findEnableButton = () => wrapper.findComponent(GlButton);
beforeEach(() => {
wrapper = shallowMountExtended(TracingEmptyState, {
propsData: {
enableTracing: jest.fn(),
},
stubs: { GlButton },
});
});
it('renders the component properly', () => {
expect(wrapper.exists()).toBe(true);
});
it('displays the correct title', () => {
const { title } = wrapper.findComponent(GlEmptyState).props();
expect(title).toBe('Get started with Tracing');
});
it('displays the correct description', () => {
const description = wrapper.find('span').text();
expect(description).toBe('Monitor your applications with GitLab Distributed Tracing.');
});
it('displays the enable button', () => {
const enableButton = findEnableButton();
expect(enableButton.exists()).toBe(true);
expect(enableButton.text()).toBe('Enable');
});
it('calls enableTracing method when enable button is clicked', () => {
findEnableButton().vm.$emit('click');
expect(wrapper.props().enableTracing).toHaveBeenCalled();
});
});
|