summaryrefslogtreecommitdiff
path: root/spec/frontend/performance_bar/components/request_selector_spec.js
blob: 42ccb1f1b5cd10fd9cf69dfc3ee6083ecbecfc0c (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
import RequestSelector from '~/performance_bar/components/request_selector.vue';
import { shallowMount } from '@vue/test-utils';

describe('request selector', () => {
  const requests = [
    {
      id: 'warningReq',
      url: 'https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/1/discussions.json',
      truncatedUrl: 'discussions.json',
      hasWarnings: true,
    },
  ];

  const wrapper = shallowMount(RequestSelector, {
    propsData: {
      requests,
      currentRequest: requests[0],
    },
  });

  it('has a warning icon if any requests have warnings', () => {
    expect(wrapper.find('span > gl-emoji').element.dataset.name).toEqual('warning');
  });

  it('adds a warning glyph to requests with warnings', () => {
    const requestValue = wrapper.find('[value="warningReq"]').text();

    expect(requestValue).toContain('discussions.json');
    expect(requestValue).toContain('(!)');
  });
});