debian-mirror-gitlab/spec/frontend/projects/compare/components/revision_card_spec.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-04-17 20:07:23 +05:30
import { GlCard } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import RepoDropdown from '~/projects/compare/components/repo_dropdown.vue';
import RevisionCard from '~/projects/compare/components/revision_card.vue';
import RevisionDropdown from '~/projects/compare/components/revision_dropdown.vue';
2021-06-08 01:23:25 +05:30
import { revisionCardDefaultProps as defaultProps } from './mock_data';
2021-04-17 20:07:23 +05:30
describe('RepoDropdown component', () => {
let wrapper;
const createComponent = (props = {}) => {
wrapper = shallowMount(RevisionCard, {
propsData: {
...defaultProps,
...props,
},
stubs: {
GlCard,
},
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
beforeEach(() => {
createComponent();
});
it('displays revision text', () => {
expect(wrapper.find(GlCard).text()).toContain(defaultProps.revisionText);
});
it('renders RepoDropdown component', () => {
expect(wrapper.findAll(RepoDropdown).exists()).toBe(true);
});
it('renders RevisionDropdown component', () => {
expect(wrapper.findAll(RevisionDropdown).exists()).toBe(true);
});
});