debian-mirror-gitlab/spec/frontend/google_cloud/components/revoke_oauth_spec.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-05-07 20:08:51 +05:30
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);
});
});