blob: 87580dbf6deb5d40e769ef35ae170e65d4365d17 (
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('RevokeOauth component', () => {
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);
});
});
|