2021-04-17 20:07:23 +05:30
|
|
|
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,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
wrapper = null;
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
createComponent();
|
|
|
|
});
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
const RevisionCardWrapper = () => wrapper.find('.revision-card');
|
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
it('displays revision text', () => {
|
2022-07-23 23:45:48 +05:30
|
|
|
expect(RevisionCardWrapper().text()).toContain(defaultProps.revisionText);
|
2021-04-17 20:07:23 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders RepoDropdown component', () => {
|
2022-10-11 01:57:18 +05:30
|
|
|
expect(wrapper.findAllComponents(RepoDropdown).exists()).toBe(true);
|
2021-04-17 20:07:23 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders RevisionDropdown component', () => {
|
2022-10-11 01:57:18 +05:30
|
|
|
expect(wrapper.findAllComponents(RevisionDropdown).exists()).toBe(true);
|
2021-04-17 20:07:23 +05:30
|
|
|
});
|
|
|
|
});
|