Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-28 12:08:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-28 12:08:26 +0300
commit4a372de7753b16d254dc319a6bad08ecac0273af (patch)
tree5590370af8341c1ac1a67d6a3f6c1feccf57b85f /spec
parent55e4390933a4e16f8936604d763a6353f088c4c1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/work_items/components/work_item_actions_spec.js8
-rw-r--r--spec/frontend/work_items/components/work_item_detail_modal_spec.js20
-rw-r--r--spec/frontend/work_items/mock_data.js16
-rw-r--r--spec/frontend/work_items/pages/work_item_root_spec.js4
-rw-r--r--spec/serializers/build_details_entity_spec.rb47
5 files changed, 62 insertions, 33 deletions
diff --git a/spec/frontend/work_items/components/work_item_actions_spec.js b/spec/frontend/work_items/components/work_item_actions_spec.js
index d0e9cfee353..286c8180e16 100644
--- a/spec/frontend/work_items/components/work_item_actions_spec.js
+++ b/spec/frontend/work_items/components/work_item_actions_spec.js
@@ -18,13 +18,13 @@ describe('WorkItemActions component', () => {
const findDeleteButton = () => wrapper.findComponent(GlDropdownItem);
const createComponent = ({
- canUpdate = true,
+ canDelete = true,
deleteWorkItemHandler = jest.fn().mockResolvedValue(deleteWorkItemResponse),
} = {}) => {
glModalDirective = jest.fn();
wrapper = shallowMount(WorkItemActions, {
apolloProvider: createMockApollo([[deleteWorkItem, deleteWorkItemHandler]]),
- propsData: { workItemId: '123', canUpdate },
+ propsData: { workItemId: '123', canDelete },
directives: {
glModal: {
bind(_, { value }) {
@@ -93,9 +93,9 @@ describe('WorkItemActions component', () => {
expect(wrapper.emitted('workItemDeleted')).toBeUndefined();
});
- it('does not render when canUpdate is false', () => {
+ it('does not render when canDelete is false', () => {
createComponent({
- canUpdate: false,
+ canDelete: false,
});
expect(wrapper.html()).toBe('');
diff --git a/spec/frontend/work_items/components/work_item_detail_modal_spec.js b/spec/frontend/work_items/components/work_item_detail_modal_spec.js
index 9f35ccb853b..bcd91bf583a 100644
--- a/spec/frontend/work_items/components/work_item_detail_modal_spec.js
+++ b/spec/frontend/work_items/components/work_item_detail_modal_spec.js
@@ -4,7 +4,6 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo';
import WorkItemDetail from '~/work_items/components/work_item_detail.vue';
import WorkItemDetailModal from '~/work_items/components/work_item_detail_modal.vue';
-import WorkItemActions from '~/work_items/components/work_item_actions.vue';
describe('WorkItemDetailModal component', () => {
let wrapper;
@@ -12,12 +11,11 @@ describe('WorkItemDetailModal component', () => {
Vue.use(VueApollo);
const findModal = () => wrapper.findComponent(GlModal);
- const findWorkItemActions = () => wrapper.findComponent(WorkItemActions);
const findWorkItemDetail = () => wrapper.findComponent(WorkItemDetail);
- const createComponent = ({ visible = true, workItemId = '1', canUpdate = false } = {}) => {
+ const createComponent = ({ visible = true, workItemId = '1' } = {}) => {
wrapper = shallowMount(WorkItemDetailModal, {
- propsData: { visible, workItemId, canUpdate },
+ propsData: { visible, workItemId },
stubs: {
GlModal,
},
@@ -36,23 +34,9 @@ describe('WorkItemDetailModal component', () => {
});
});
- it('renders heading', () => {
- createComponent();
-
- expect(wrapper.find('h2').text()).toBe('Work Item');
- });
-
it('renders WorkItemDetail', () => {
createComponent();
expect(findWorkItemDetail().props()).toEqual({ workItemId: '1' });
});
-
- it('shows work item actions', () => {
- createComponent({
- canUpdate: true,
- });
-
- expect(findWorkItemActions().exists()).toBe(true);
- });
});
diff --git a/spec/frontend/work_items/mock_data.js b/spec/frontend/work_items/mock_data.js
index 1b2944b6078..8aea475ba07 100644
--- a/spec/frontend/work_items/mock_data.js
+++ b/spec/frontend/work_items/mock_data.js
@@ -10,6 +10,10 @@ export const workItemQueryResponse = {
id: 'gid://gitlab/WorkItems::Type/5',
name: 'Task',
},
+ userPermissions: {
+ deleteWorkItem: false,
+ updateWorkItem: false,
+ },
},
},
};
@@ -28,6 +32,10 @@ export const updateWorkItemMutationResponse = {
id: 'gid://gitlab/WorkItems::Type/5',
name: 'Task',
},
+ userPermissions: {
+ deleteWorkItem: false,
+ updateWorkItem: false,
+ },
},
},
},
@@ -61,6 +69,10 @@ export const createWorkItemMutationResponse = {
id: 'gid://gitlab/WorkItems::Type/5',
name: 'Task',
},
+ userPermissions: {
+ deleteWorkItem: false,
+ updateWorkItem: false,
+ },
},
},
},
@@ -75,6 +87,10 @@ export const createWorkItemFromTaskMutationResponse = {
descriptionHtml: '<p>New description</p>',
id: 'gid://gitlab/WorkItem/13',
__typename: 'WorkItem',
+ userPermissions: {
+ deleteWorkItem: false,
+ updateWorkItem: false,
+ },
},
},
},
diff --git a/spec/frontend/work_items/pages/work_item_root_spec.js b/spec/frontend/work_items/pages/work_item_root_spec.js
index 2803724b9af..81d01a0cb45 100644
--- a/spec/frontend/work_items/pages/work_item_root_spec.js
+++ b/spec/frontend/work_items/pages/work_item_root_spec.js
@@ -26,6 +26,8 @@ describe('Work items root component', () => {
it('renders WorkItemDetail', () => {
createComponent();
- expect(findWorkItemDetail().props()).toEqual({ workItemId: 'gid://gitlab/WorkItem/1' });
+ expect(findWorkItemDetail().props()).toEqual({
+ workItemId: 'gid://gitlab/WorkItem/1',
+ });
});
});
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb
index da2734feb51..dd8238456aa 100644
--- a/spec/serializers/build_details_entity_spec.rb
+++ b/spec/serializers/build_details_entity_spec.rb
@@ -127,21 +127,48 @@ RSpec.describe BuildDetailsEntity do
end
context 'when the build has failed due to a missing dependency' do
- let!(:test1) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test1', stage_idx: 0) }
- let!(:test2) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test2', stage_idx: 1) }
- let!(:build) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w(test1 test2) }) }
let(:message) { subject[:callout_message] }
- before do
- build.pipeline.unlocked!
- build.drop!(:missing_dependency_failure)
+ context 'when the dependency is in the same pipeline' do
+ let!(:test1) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test1', stage_idx: 0) }
+ let!(:test2) { create(:ci_build, :success, :expired, pipeline: pipeline, name: 'test2', stage_idx: 1) }
+ let!(:build) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w(test1 test2) }) }
+
+ before do
+ build.pipeline.unlocked!
+ build.drop!(:missing_dependency_failure)
+ end
+
+ it { is_expected.to include(failure_reason: 'missing_dependency_failure') }
+
+ it 'includes the failing dependencies in the callout message' do
+ expect(message).to include('test1')
+ expect(message).to include('test2')
+ end
+
+ it 'includes message for list of invalid dependencies' do
+ expect(message).to include('could not retrieve the needed artifacts:')
+ end
end
- it { is_expected.to include(failure_reason: 'missing_dependency_failure') }
+ context 'when dependency is not found' do
+ let!(:build) { create(:ci_build, :pending, pipeline: pipeline, stage_idx: 2, options: { dependencies: %w(test1 test2) }) }
+
+ before do
+ build.pipeline.unlocked!
+ build.drop!(:missing_dependency_failure)
+ end
- it 'includes the failing dependencies in the callout message' do
- expect(message).to include('test1')
- expect(message).to include('test2')
+ it { is_expected.to include(failure_reason: 'missing_dependency_failure') }
+
+ it 'excludes the failing dependencies in the callout message' do
+ expect(message).not_to include('test1')
+ expect(message).not_to include('test2')
+ end
+
+ it 'includes the correct punctuation in the message' do
+ expect(message).to include('could not retrieve the needed artifacts.')
+ end
end
end