Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gcp_error_spec.js « errors « components « google_cloud « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4062a8b902a948950cdda8fc39e6dae8bab14740 (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
import { shallowMount } from '@vue/test-utils';
import { GlAlert } from '@gitlab/ui';
import GcpError from '~/google_cloud/components/errors/gcp_error.vue';

describe('GcpError component', () => {
  let wrapper;

  const findAlert = () => wrapper.findComponent(GlAlert);
  const findBlockquote = () => wrapper.find('blockquote');

  const propsData = { error: 'IAM and CloudResourceManager API disabled' };

  beforeEach(() => {
    wrapper = shallowMount(GcpError, { propsData });
  });

  afterEach(() => {
    wrapper.destroy();
  });

  it('contains alert', () => {
    expect(findAlert().exists()).toBe(true);
  });

  it('contains relevant text', () => {
    const alertText = findAlert().text();
    expect(findAlert().props('title')).toBe(GcpError.i18n.title);
    expect(alertText).toContain(GcpError.i18n.description);
  });

  it('contains error stacktrace', () => {
    expect(findBlockquote().text()).toBe(propsData.error);
  });
});