debian-mirror-gitlab/spec/javascripts/diffs/components/compare_versions_dropdown_spec.js

35 lines
1 KiB
JavaScript
Raw Normal View History

2018-11-08 19:23:39 +05:30
// TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
2019-03-02 22:35:43 +05:30
import { shallowMount, createLocalVue } from '@vue/test-utils';
import CompareVersionsDropdown from '~/diffs/components/compare_versions_dropdown.vue';
import diffsMockData from '../mock_data/merge_request_diffs';
describe('CompareVersionsDropdown', () => {
let wrapper;
const targetBranch = { branchName: 'tmp-wine-dev', versionIndex: -1 };
const factory = (options = {}) => {
const localVue = createLocalVue();
wrapper = shallowMount(CompareVersionsDropdown, { localVue, ...options });
};
afterEach(() => {
wrapper.destroy();
});
it('should render a correct base version link', () => {
factory({
propsData: {
baseVersionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=37',
otherVersions: diffsMockData.slice(1),
targetBranch,
},
});
const links = wrapper.findAll('a');
const lastLink = links.wrappers[links.length - 1];
expect(lastLink.attributes('href')).toEqual(wrapper.props('baseVersionPath'));
});
});