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

revoke_oauth_spec.js « components « google_cloud « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: faaec07fc35b343eb38c48c24b4066944d4de0c3 (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
45
46
47
import { shallowMount } from '@vue/test-utils';
import { GlButton, GlForm } from '@gitlab/ui';
import RevokeOauth, {
  GOOGLE_CLOUD_REVOKE_TITLE,
  GOOGLE_CLOUD_REVOKE_DESCRIPTION,
} from '~/google_cloud/components/revoke_oauth.vue';

describe('google_cloud/components/revoke_oauth', () => {
  let wrapper;

  const findTitle = () => wrapper.find('h2');
  const findDescription = () => wrapper.find('p');
  const findForm = () => wrapper.findComponent(GlForm);
  const findButton = () => wrapper.findComponent(GlButton);
  const propsData = {
    url: 'url_general_feedback',
  };

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

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

  it('contains title', () => {
    const title = findTitle();
    expect(title.text()).toContain('Revoke authorizations');
  });

  it('contains description', () => {
    const description = findDescription();
    expect(description.text()).toContain(GOOGLE_CLOUD_REVOKE_DESCRIPTION);
  });

  it('contains form', () => {
    const form = findForm();
    expect(form.attributes('action')).toBe(propsData.url);
    expect(form.attributes('method')).toBe('post');
  });

  it('contains button', () => {
    const button = findButton();
    expect(button.text()).toContain(GOOGLE_CLOUD_REVOKE_TITLE);
  });
});