Commit 308a3a85 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '337924-jest-as-if-foss-2-2-failing' into 'master'

Resolve "jest-as-if-foss 2/2 failing" [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!67733
parents 35e87a4a b21a1d08
import { shallowMount } from '@vue/test-utils';
import LockButton from 'ee_component/repository/components/lock_button.vue';
import BlobButtonGroup from '~/repository/components/blob_button_group.vue';
const DEFAULT_PROPS = {
name: 'some name',
path: 'some/path',
canPushCode: true,
replacePath: 'some/replace/path',
deletePath: 'some/delete/path',
emptyRepo: false,
projectPath: 'some/project/path',
isLocked: false,
canLock: true,
};
const DEFAULT_INJECT = {
glFeatures: { fileLocks: true },
targetBranch: 'master',
originalBranch: 'master',
};
describe('EE BlobButtonGroup component', () => {
let wrapper;
const createComponent = (props = {}) => {
wrapper = shallowMount(BlobButtonGroup, {
propsData: {
...DEFAULT_PROPS,
...props,
},
provide: {
...DEFAULT_INJECT,
},
});
};
const findLockButton = () => wrapper.findComponent(LockButton);
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('renders component', () => {
const { name, path } = DEFAULT_PROPS;
expect(wrapper.props()).toMatchObject({
name,
path,
});
});
it('renders the lock button', () => {
expect(findLockButton().exists()).toBe(true);
expect(findLockButton().props()).toMatchObject({
canLock: true,
isLocked: false,
name: 'some name',
path: 'some/path',
projectPath: 'some/project/path',
});
});
});
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import LockButton from 'ee_component/repository/components/lock_button.vue';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import BlobButtonGroup from '~/repository/components/blob_button_group.vue'; import BlobButtonGroup from '~/repository/components/blob_button_group.vue';
import DeleteBlobModal from '~/repository/components/delete_blob_modal.vue'; import DeleteBlobModal from '~/repository/components/delete_blob_modal.vue';
...@@ -19,7 +18,6 @@ const DEFAULT_PROPS = { ...@@ -19,7 +18,6 @@ const DEFAULT_PROPS = {
}; };
const DEFAULT_INJECT = { const DEFAULT_INJECT = {
glFeatures: { fileLocks: true },
targetBranch: 'master', targetBranch: 'master',
originalBranch: 'master', originalBranch: 'master',
}; };
...@@ -49,7 +47,6 @@ describe('BlobButtonGroup component', () => { ...@@ -49,7 +47,6 @@ describe('BlobButtonGroup component', () => {
const findDeleteBlobModal = () => wrapper.findComponent(DeleteBlobModal); const findDeleteBlobModal = () => wrapper.findComponent(DeleteBlobModal);
const findUploadBlobModal = () => wrapper.findComponent(UploadBlobModal); const findUploadBlobModal = () => wrapper.findComponent(UploadBlobModal);
const findReplaceButton = () => wrapper.find('[data-testid="replace"]'); const findReplaceButton = () => wrapper.find('[data-testid="replace"]');
const findLockButton = () => wrapper.findComponent(LockButton);
it('renders component', () => { it('renders component', () => {
createComponent(); createComponent();
...@@ -67,18 +64,6 @@ describe('BlobButtonGroup component', () => { ...@@ -67,18 +64,6 @@ describe('BlobButtonGroup component', () => {
createComponent(); createComponent();
}); });
it('renders the lock button', () => {
expect(findLockButton().exists()).toBe(true);
expect(findLockButton().props()).toMatchObject({
canLock: true,
isLocked: false,
name: 'some name',
path: 'some/path',
projectPath: 'some/project/path',
});
});
it('renders both the replace and delete button', () => { it('renders both the replace and delete button', () => {
expect(wrapper.findAll(GlButton)).toHaveLength(2); expect(wrapper.findAll(GlButton)).toHaveLength(2);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment