summaryrefslogtreecommitdiff
path: root/spec/frontend/google_cloud/components/errors/no_gcp_projects_spec.js
blob: e1e203778806a30dfc51ca9a62a62a628589d223 (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
import { mount } from '@vue/test-utils';
import { GlAlert, GlButton } from '@gitlab/ui';
import NoGcpProjects from '~/google_cloud/components/errors/no_gcp_projects.vue';

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

  const findAlert = () => wrapper.findComponent(GlAlert);
  const findButton = () => wrapper.findComponent(GlButton);

  beforeEach(() => {
    wrapper = mount(NoGcpProjects);
  });

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

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

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

  it('contains create gcp project button', () => {
    const button = findButton();
    expect(button.text()).toBe(NoGcpProjects.i18n.createLabel);
    expect(button.attributes('href')).toBe('https://console.cloud.google.com/projectcreate');
  });
});