Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
99bcbec56c
commit
cb09086128
|
@ -1 +1 @@
|
||||||
7034511c6f456177e023d7b418ceaa391deee79a
|
3ef55853e9e161204464868390d97d1a1577042d
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import { mapActions, mapState } from 'vuex';
|
import { mapActions, mapState } from 'vuex';
|
||||||
import { __ } from '~/locale';
|
import { __ } from '~/locale';
|
||||||
|
import Tracking from '~/tracking';
|
||||||
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
||||||
import { mapComputed } from '~/vuex_shared/bindings';
|
import { mapComputed } from '~/vuex_shared/bindings';
|
||||||
import {
|
import {
|
||||||
|
@ -25,10 +26,14 @@ import {
|
||||||
AWS_TIP_DISMISSED_COOKIE_NAME,
|
AWS_TIP_DISMISSED_COOKIE_NAME,
|
||||||
AWS_TIP_MESSAGE,
|
AWS_TIP_MESSAGE,
|
||||||
CONTAINS_VARIABLE_REFERENCE_MESSAGE,
|
CONTAINS_VARIABLE_REFERENCE_MESSAGE,
|
||||||
|
EVENT_LABEL,
|
||||||
|
EVENT_ACTION,
|
||||||
} from '../constants';
|
} from '../constants';
|
||||||
import CiEnvironmentsDropdown from './ci_environments_dropdown.vue';
|
import CiEnvironmentsDropdown from './ci_environments_dropdown.vue';
|
||||||
import { awsTokens, awsTokenList } from './ci_variable_autocomplete_tokens';
|
import { awsTokens, awsTokenList } from './ci_variable_autocomplete_tokens';
|
||||||
|
|
||||||
|
const trackingMixin = Tracking.mixin({ label: EVENT_LABEL });
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
modalId: ADD_CI_VARIABLE_MODAL_ID,
|
modalId: ADD_CI_VARIABLE_MODAL_ID,
|
||||||
tokens: awsTokens,
|
tokens: awsTokens,
|
||||||
|
@ -51,10 +56,11 @@ export default {
|
||||||
GlModal,
|
GlModal,
|
||||||
GlSprintf,
|
GlSprintf,
|
||||||
},
|
},
|
||||||
mixins: [glFeatureFlagsMixin()],
|
mixins: [glFeatureFlagsMixin(), trackingMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isTipDismissed: Cookies.get(AWS_TIP_DISMISSED_COOKIE_NAME) === 'true',
|
isTipDismissed: Cookies.get(AWS_TIP_DISMISSED_COOKIE_NAME) === 'true',
|
||||||
|
validationErrorEventProperty: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -147,6 +153,14 @@ export default {
|
||||||
return this.variable.secret_value === '' || (this.tokenValidationState && this.maskedState);
|
return this.variable.secret_value === '' || (this.tokenValidationState && this.maskedState);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
variable: {
|
||||||
|
handler() {
|
||||||
|
this.trackVariableValidationErrors();
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'addVariable',
|
'addVariable',
|
||||||
|
@ -179,6 +193,7 @@ export default {
|
||||||
|
|
||||||
this.clearModal();
|
this.clearModal();
|
||||||
this.resetSelectedEnvironment();
|
this.resetSelectedEnvironment();
|
||||||
|
this.resetValidationErrorEvents();
|
||||||
},
|
},
|
||||||
updateOrAddVariable() {
|
updateOrAddVariable() {
|
||||||
if (this.variableBeingEdited) {
|
if (this.variableBeingEdited) {
|
||||||
|
@ -193,6 +208,31 @@ export default {
|
||||||
this.setVariableProtected();
|
this.setVariableProtected();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
trackVariableValidationErrors() {
|
||||||
|
const property = this.getTrackingErrorProperty();
|
||||||
|
if (!this.validationErrorEventProperty && property) {
|
||||||
|
this.track(EVENT_ACTION, { property });
|
||||||
|
this.validationErrorEventProperty = property;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getTrackingErrorProperty() {
|
||||||
|
let property;
|
||||||
|
if (this.variable.secret_value?.length && !property) {
|
||||||
|
if (this.displayMaskedError && this.maskableRegex?.length) {
|
||||||
|
const supportedChars = this.maskableRegex.replace('^', '').replace(/{(\d,)}\$/, '');
|
||||||
|
const regex = new RegExp(supportedChars, 'g');
|
||||||
|
property = this.variable.secret_value.replace(regex, '');
|
||||||
|
}
|
||||||
|
if (this.containsVariableReference) {
|
||||||
|
property = '$';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return property;
|
||||||
|
},
|
||||||
|
resetValidationErrorEvents() {
|
||||||
|
this.validationErrorEventProperty = '';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -19,6 +19,9 @@ export const AWS_TIP_MESSAGE = __(
|
||||||
'%{deployLinkStart}Use a template to deploy to ECS%{deployLinkEnd}, or use a docker image to %{commandsLinkStart}run AWS commands in GitLab CI/CD%{commandsLinkEnd}.',
|
'%{deployLinkStart}Use a template to deploy to ECS%{deployLinkEnd}, or use a docker image to %{commandsLinkStart}run AWS commands in GitLab CI/CD%{commandsLinkEnd}.',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const EVENT_LABEL = 'ci_variable_modal';
|
||||||
|
export const EVENT_ACTION = 'validation_error';
|
||||||
|
|
||||||
// AWS TOKEN CONSTANTS
|
// AWS TOKEN CONSTANTS
|
||||||
export const AWS_ACCESS_KEY_ID = 'AWS_ACCESS_KEY_ID';
|
export const AWS_ACCESS_KEY_ID = 'AWS_ACCESS_KEY_ID';
|
||||||
export const AWS_DEFAULT_REGION = 'AWS_DEFAULT_REGION';
|
export const AWS_DEFAULT_REGION = 'AWS_DEFAULT_REGION';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%div{ class: 'search-result-row gl-display-flex gl-sm-flex-direction-row gl-flex-direction-column gl-align-items-center gl-pb-3! gl-mt-5 gl-mb-0!' }
|
%div{ class: 'search-result-row gl-display-flex gl-sm-flex-direction-row gl-flex-direction-column gl-align-items-center gl-pb-3! gl-mt-5 gl-mb-0!' }
|
||||||
.col-sm-9
|
.col-sm-9
|
||||||
%span.gl-display-flex.gl-align-items-center
|
%span.gl-display-flex.gl-align-items-center
|
||||||
%span.badge.badge-pill.gl-badge.sm{ class: "badge-#{issuable_state_to_badge_class(issuable)}" }= issuable_state_text(issuable)
|
= gl_badge_tag issuable_state_text(issuable), variant: issuable_state_to_badge_class(issuable), size: :sm
|
||||||
= sprite_icon('eye-slash', css_class: 'gl-text-gray-500 gl-ml-2') if issuable.respond_to?(:confidential?) && issuable.confidential?
|
= sprite_icon('eye-slash', css_class: 'gl-text-gray-500 gl-ml-2') if issuable.respond_to?(:confidential?) && issuable.confidential?
|
||||||
= link_to issuable_path(issuable), data: { track_action: 'click_text', track_label: "#{issuable.class.name.downcase}_title", track_property: 'search_result' }, class: 'gl-w-full' do
|
= link_to issuable_path(issuable), data: { track_action: 'click_text', track_label: "#{issuable.class.name.downcase}_title", track_property: 'search_result' }, class: 'gl-w-full' do
|
||||||
%span.term.str-truncated.gl-font-weight-bold.gl-ml-2= issuable.title
|
%span.term.str-truncated.gl-font-weight-bold.gl-ml-2= issuable.title
|
||||||
|
|
|
@ -73,7 +73,7 @@ module Gitlab
|
||||||
|
|
||||||
def key_from_to_header
|
def key_from_to_header
|
||||||
mail.to.find do |address|
|
mail.to.find do |address|
|
||||||
key = Gitlab::IncomingEmail.key_from_address(address)
|
key = email_class.key_from_address(address)
|
||||||
break key if key
|
break key if key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -100,7 +100,7 @@ module Gitlab
|
||||||
|
|
||||||
def find_key_from_references
|
def find_key_from_references
|
||||||
ensure_references_array(mail.references).find do |mail_id|
|
ensure_references_array(mail.references).find do |mail_id|
|
||||||
key = Gitlab::IncomingEmail.key_from_fallback_message_id(mail_id)
|
key = email_class.key_from_fallback_message_id(mail_id)
|
||||||
break key if key
|
break key if key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -119,21 +119,21 @@ module Gitlab
|
||||||
|
|
||||||
def find_key_from_delivered_to_header
|
def find_key_from_delivered_to_header
|
||||||
delivered_to.find do |header|
|
delivered_to.find do |header|
|
||||||
key = Gitlab::IncomingEmail.key_from_address(header.value)
|
key = email_class.key_from_address(header.value)
|
||||||
break key if key
|
break key if key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_key_from_envelope_to_header
|
def find_key_from_envelope_to_header
|
||||||
envelope_to.find do |header|
|
envelope_to.find do |header|
|
||||||
key = Gitlab::IncomingEmail.key_from_address(header.value)
|
key = email_class.key_from_address(header.value)
|
||||||
break key if key
|
break key if key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_key_from_x_envelope_to_header
|
def find_key_from_x_envelope_to_header
|
||||||
x_envelope_to.find do |header|
|
x_envelope_to.find do |header|
|
||||||
key = Gitlab::IncomingEmail.key_from_address(header.value)
|
key = email_class.key_from_address(header.value)
|
||||||
break key if key
|
break key if key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -158,6 +158,10 @@ module Gitlab
|
||||||
|
|
||||||
autoreply && autoreply == 'yes'
|
autoreply && autoreply == 'yes'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def email_class
|
||||||
|
Gitlab::IncomingEmail
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,22 +6,13 @@ module Gitlab
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_handler
|
def find_handler
|
||||||
return unless service_desk_key
|
return unless mail_key
|
||||||
|
|
||||||
Gitlab::Email::Handler::ServiceDeskHandler.new(mail, nil, service_desk_key: service_desk_key)
|
Gitlab::Email::Handler::ServiceDeskHandler.new(mail, nil, service_desk_key: mail_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
def service_desk_key
|
def email_class
|
||||||
strong_memoize(:service_desk_key) do
|
::Gitlab::ServiceDeskEmail
|
||||||
find_service_desk_key
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def find_service_desk_key
|
|
||||||
mail.to.find do |address|
|
|
||||||
key = ::Gitlab::ServiceDeskEmail.key_from_address(address)
|
|
||||||
break key if key
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -160,6 +160,8 @@ module Gitlab
|
||||||
wrapped_gitaly_errors do
|
wrapped_gitaly_errors do
|
||||||
gitaly_repository_client.remove
|
gitaly_repository_client.remove
|
||||||
end
|
end
|
||||||
|
rescue NoRepository
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def replicate(source_repository)
|
def replicate(source_repository)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
Envelope-To: support+project_slug-project_key@example.com
|
||||||
|
Return-Path: <alan@adventuretime.ooo>
|
||||||
|
Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
|
||||||
|
Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 17:03:50 -0400
|
||||||
|
Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <incoming+email-test-project_id-issue-@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 14:03:48 -0700
|
||||||
|
Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
|
||||||
|
Date: Thu, 13 Jun 2013 17:03:48 -0400
|
||||||
|
From: Jake the Dog <alan@adventuretime.ooo>
|
||||||
|
To: support@example.com
|
||||||
|
Message-ID: <CAH_Wr+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||||
|
In-Reply-To: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||||
|
Subject: The message subject! @all
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset=ISO-8859-1
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
X-Sieve: CMU Sieve 2.2
|
||||||
|
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
|
||||||
|
13 Jun 2013 14:03:48 -0700 (PDT)
|
||||||
|
X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
|
||||||
|
|
||||||
|
Service desk reply!
|
||||||
|
|
||||||
|
/label ~label2
|
|
@ -0,0 +1,24 @@
|
||||||
|
Delivered-To: support+project_slug-project_key@example.com
|
||||||
|
Return-Path: <alan@adventuretime.ooo>
|
||||||
|
Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
|
||||||
|
Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 17:03:50 -0400
|
||||||
|
Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <incoming+email-test-project_id-issue-@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 14:03:48 -0700
|
||||||
|
Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
|
||||||
|
Date: Thu, 13 Jun 2013 17:03:48 -0400
|
||||||
|
From: Jake the Dog <alan@adventuretime.ooo>
|
||||||
|
To: support@example.com
|
||||||
|
Message-ID: <CAH_Wr+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||||
|
In-Reply-To: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||||
|
Subject: The message subject! @all
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset=ISO-8859-1
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
X-Sieve: CMU Sieve 2.2
|
||||||
|
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
|
||||||
|
13 Jun 2013 14:03:48 -0700 (PDT)
|
||||||
|
X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
|
||||||
|
|
||||||
|
Service desk reply!
|
||||||
|
|
||||||
|
/label ~label2
|
|
@ -0,0 +1,24 @@
|
||||||
|
X-Envelope-To: support+project_slug-project_key@example.com
|
||||||
|
Return-Path: <alan@adventuretime.ooo>
|
||||||
|
Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
|
||||||
|
Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 17:03:50 -0400
|
||||||
|
Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <incoming+email-test-project_id-issue-@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 14:03:48 -0700
|
||||||
|
Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
|
||||||
|
Date: Thu, 13 Jun 2013 17:03:48 -0400
|
||||||
|
From: Jake the Dog <alan@adventuretime.ooo>
|
||||||
|
To: support@example.com
|
||||||
|
Message-ID: <CAH_Wr+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||||
|
In-Reply-To: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
|
||||||
|
Subject: The message subject! @all
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset=ISO-8859-1
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
X-Sieve: CMU Sieve 2.2
|
||||||
|
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
|
||||||
|
13 Jun 2013 14:03:48 -0700 (PDT)
|
||||||
|
X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
|
||||||
|
|
||||||
|
Service desk reply!
|
||||||
|
|
||||||
|
/label ~label2
|
|
@ -1,9 +1,10 @@
|
||||||
import { GlButton, GlFormInput } from '@gitlab/ui';
|
import { GlButton, GlFormInput } from '@gitlab/ui';
|
||||||
import { createLocalVue, shallowMount, mount } from '@vue/test-utils';
|
import { createLocalVue, shallowMount, mount } from '@vue/test-utils';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
import { mockTracking } from 'helpers/tracking_helper';
|
||||||
import CiEnvironmentsDropdown from '~/ci_variable_list/components/ci_environments_dropdown.vue';
|
import CiEnvironmentsDropdown from '~/ci_variable_list/components/ci_environments_dropdown.vue';
|
||||||
import CiVariableModal from '~/ci_variable_list/components/ci_variable_modal.vue';
|
import CiVariableModal from '~/ci_variable_list/components/ci_variable_modal.vue';
|
||||||
import { AWS_ACCESS_KEY_ID } from '~/ci_variable_list/constants';
|
import { AWS_ACCESS_KEY_ID, EVENT_LABEL, EVENT_ACTION } from '~/ci_variable_list/constants';
|
||||||
import createStore from '~/ci_variable_list/store';
|
import createStore from '~/ci_variable_list/store';
|
||||||
import mockData from '../services/mock_data';
|
import mockData from '../services/mock_data';
|
||||||
import ModalStub from '../stubs';
|
import ModalStub from '../stubs';
|
||||||
|
@ -14,9 +15,12 @@ localVue.use(Vuex);
|
||||||
describe('Ci variable modal', () => {
|
describe('Ci variable modal', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let store;
|
let store;
|
||||||
|
let trackingSpy;
|
||||||
|
|
||||||
|
const maskableRegex = '^[a-zA-Z0-9_+=/@:.~-]{8,}$';
|
||||||
|
|
||||||
const createComponent = (method, options = {}) => {
|
const createComponent = (method, options = {}) => {
|
||||||
store = createStore({ isGroup: options.isGroup });
|
store = createStore({ maskableRegex, isGroup: options.isGroup });
|
||||||
wrapper = method(CiVariableModal, {
|
wrapper = method(CiVariableModal, {
|
||||||
attachTo: document.body,
|
attachTo: document.body,
|
||||||
stubs: {
|
stubs: {
|
||||||
|
@ -138,6 +142,7 @@ describe('Ci variable modal', () => {
|
||||||
};
|
};
|
||||||
createComponent(mount);
|
createComponent(mount);
|
||||||
store.state.variable = invalidKeyVariable;
|
store.state.variable = invalidKeyVariable;
|
||||||
|
trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`${rendered ? 'renders' : 'does not render'} the variable reference warning`, () => {
|
it(`${rendered ? 'renders' : 'does not render'} the variable reference warning`, () => {
|
||||||
|
@ -226,6 +231,7 @@ describe('Ci variable modal', () => {
|
||||||
};
|
};
|
||||||
createComponent(mount);
|
createComponent(mount);
|
||||||
store.state.variable = invalidMaskVariable;
|
store.state.variable = invalidMaskVariable;
|
||||||
|
trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('disables the submit button', () => {
|
it('disables the submit button', () => {
|
||||||
|
@ -235,6 +241,50 @@ describe('Ci variable modal', () => {
|
||||||
it('shows the correct error text', () => {
|
it('shows the correct error text', () => {
|
||||||
expect(findModal().text()).toContain(maskError);
|
expect(findModal().text()).toContain(maskError);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sends the correct tracking event', () => {
|
||||||
|
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTION, {
|
||||||
|
label: EVENT_LABEL,
|
||||||
|
property: ';',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe.each`
|
||||||
|
value | secret | masked | eventSent | trackingErrorProperty
|
||||||
|
${'value'} | ${'secretValue'} | ${false} | ${0} | ${null}
|
||||||
|
${'shortMasked'} | ${'short'} | ${true} | ${0} | ${null}
|
||||||
|
${'withDollar$Sign'} | ${'dollar$ign'} | ${false} | ${1} | ${'$'}
|
||||||
|
${'withDollar$Sign'} | ${'dollar$ign'} | ${true} | ${1} | ${'$'}
|
||||||
|
${'unsupported'} | ${'unsupported|char'} | ${true} | ${1} | ${'|'}
|
||||||
|
${'unsupportedMasked'} | ${'unsupported|char'} | ${false} | ${0} | ${null}
|
||||||
|
`('Adding a new variable', ({ value, secret, masked, eventSent, trackingErrorProperty }) => {
|
||||||
|
beforeEach(() => {
|
||||||
|
const [variable] = mockData.mockVariables;
|
||||||
|
const invalidKeyVariable = {
|
||||||
|
...variable,
|
||||||
|
key: 'key',
|
||||||
|
value,
|
||||||
|
secret_value: secret,
|
||||||
|
masked,
|
||||||
|
};
|
||||||
|
createComponent(mount);
|
||||||
|
store.state.variable = invalidKeyVariable;
|
||||||
|
trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`${
|
||||||
|
eventSent > 0 ? 'sends the correct' : 'does not send the'
|
||||||
|
} variable validation tracking event`, () => {
|
||||||
|
expect(trackingSpy).toHaveBeenCalledTimes(eventSent);
|
||||||
|
|
||||||
|
if (eventSent > 0) {
|
||||||
|
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTION, {
|
||||||
|
label: EVENT_LABEL,
|
||||||
|
property: trackingErrorProperty,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when both states are valid', () => {
|
describe('when both states are valid', () => {
|
||||||
|
@ -249,7 +299,6 @@ describe('Ci variable modal', () => {
|
||||||
};
|
};
|
||||||
createComponent(mount);
|
createComponent(mount);
|
||||||
store.state.variable = validMaskandKeyVariable;
|
store.state.variable = validMaskandKeyVariable;
|
||||||
store.state.maskableRegex = /^[a-zA-Z0-9_+=/@:.~-]{8,}$/;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not disable the submit button', () => {
|
it('does not disable the submit button', () => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createLocalVue } from '@vue/test-utils';
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
|
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
|
||||||
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
|
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
|
||||||
|
@ -9,8 +9,7 @@ import IssuableHeaderWarnings from '~/issuable/components/issuable_header_warnin
|
||||||
const ISSUABLE_TYPE_ISSUE = 'issue';
|
const ISSUABLE_TYPE_ISSUE = 'issue';
|
||||||
const ISSUABLE_TYPE_MR = 'merge request';
|
const ISSUABLE_TYPE_MR = 'merge request';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
describe('IssuableHeaderWarnings', () => {
|
describe('IssuableHeaderWarnings', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
@ -24,7 +23,6 @@ describe('IssuableHeaderWarnings', () => {
|
||||||
const createComponent = ({ store, provide }) => {
|
const createComponent = ({ store, provide }) => {
|
||||||
wrapper = shallowMountExtended(IssuableHeaderWarnings, {
|
wrapper = shallowMountExtended(IssuableHeaderWarnings, {
|
||||||
store,
|
store,
|
||||||
localVue,
|
|
||||||
provide,
|
provide,
|
||||||
directives: {
|
directives: {
|
||||||
GlTooltip: createMockDirective(),
|
GlTooltip: createMockDirective(),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { createLocalVue, shallowMount, mount } from '@vue/test-utils';
|
import { shallowMount, mount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import {
|
import {
|
||||||
TRANSITION_LOAD_START,
|
TRANSITION_LOAD_START,
|
||||||
|
@ -11,15 +12,13 @@ import {
|
||||||
} from '~/diffs/constants';
|
} from '~/diffs/constants';
|
||||||
import Renamed from '~/vue_shared/components/diff_viewer/viewers/renamed.vue';
|
import Renamed from '~/vue_shared/components/diff_viewer/viewers/renamed.vue';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
function createRenamedComponent({ props = {}, store = new Vuex.Store({}), deep = false }) {
|
function createRenamedComponent({ props = {}, store = new Vuex.Store({}), deep = false }) {
|
||||||
const mnt = deep ? mount : shallowMount;
|
const mnt = deep ? mount : shallowMount;
|
||||||
|
|
||||||
return mnt(Renamed, {
|
return mnt(Renamed, {
|
||||||
propsData: { ...props },
|
propsData: { ...props },
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { GlModal } from '@gitlab/ui';
|
import { GlModal } from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import { BV_SHOW_MODAL, BV_HIDE_MODAL } from '~/lib/utils/constants';
|
import { BV_SHOW_MODAL, BV_HIDE_MODAL } from '~/lib/utils/constants';
|
||||||
import GlModalVuex from '~/vue_shared/components/gl_modal_vuex.vue';
|
import GlModalVuex from '~/vue_shared/components/gl_modal_vuex.vue';
|
||||||
import createState from '~/vuex_shared/modules/modal/state';
|
import createState from '~/vuex_shared/modules/modal/state';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
const TEST_SLOT = 'Lorem ipsum modal dolar sit.';
|
const TEST_SLOT = 'Lorem ipsum modal dolar sit.';
|
||||||
const TEST_MODAL_ID = 'my-modal-id';
|
const TEST_MODAL_ID = 'my-modal-id';
|
||||||
|
@ -36,7 +36,6 @@ describe('GlModalVuex', () => {
|
||||||
|
|
||||||
wrapper = shallowMount(GlModalVuex, {
|
wrapper = shallowMount(GlModalVuex, {
|
||||||
...options,
|
...options,
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
propsData,
|
propsData,
|
||||||
stubs: {
|
stubs: {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import IssuePlaceholderNote from '~/vue_shared/components/notes/placeholder_note.vue';
|
import IssuePlaceholderNote from '~/vue_shared/components/notes/placeholder_note.vue';
|
||||||
import { userDataMock } from '../../../notes/mock_data';
|
import { userDataMock } from '../../../notes/mock_data';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
const getters = {
|
const getters = {
|
||||||
getUserData: () => userDataMock,
|
getUserData: () => userDataMock,
|
||||||
|
@ -17,7 +17,6 @@ describe('Issue placeholder note component', () => {
|
||||||
|
|
||||||
const createComponent = (isIndividual = false) => {
|
const createComponent = (isIndividual = false) => {
|
||||||
wrapper = shallowMount(IssuePlaceholderNote, {
|
wrapper = shallowMount(IssuePlaceholderNote, {
|
||||||
localVue,
|
|
||||||
store: new Vuex.Store({
|
store: new Vuex.Store({
|
||||||
getters,
|
getters,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import mockProjects from 'test_fixtures_static/projects.json';
|
import mockProjects from 'test_fixtures_static/projects.json';
|
||||||
import { trimText } from 'helpers/text_helper';
|
import { trimText } from 'helpers/text_helper';
|
||||||
import ProjectAvatar from '~/vue_shared/components/deprecated_project_avatar/default.vue';
|
import ProjectAvatar from '~/vue_shared/components/deprecated_project_avatar/default.vue';
|
||||||
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
|
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
|
||||||
|
|
||||||
describe('ProjectListItem component', () => {
|
describe('ProjectListItem component', () => {
|
||||||
const Component = localVue.extend(ProjectListItem);
|
const Component = Vue.extend(ProjectListItem);
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let vm;
|
let vm;
|
||||||
let options;
|
let options;
|
||||||
|
@ -20,7 +19,6 @@ describe('ProjectListItem component', () => {
|
||||||
project,
|
project,
|
||||||
selected: false,
|
selected: false,
|
||||||
},
|
},
|
||||||
localVue,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { GlSearchBoxByType, GlInfiniteScroll } from '@gitlab/ui';
|
import { GlSearchBoxByType, GlInfiniteScroll } from '@gitlab/ui';
|
||||||
import { mount, createLocalVue } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import { head } from 'lodash';
|
import { head } from 'lodash';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import mockProjects from 'test_fixtures_static/projects.json';
|
import mockProjects from 'test_fixtures_static/projects.json';
|
||||||
|
@ -7,8 +7,6 @@ import { trimText } from 'helpers/text_helper';
|
||||||
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
|
import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue';
|
||||||
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
|
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
|
||||||
|
|
||||||
describe('ProjectSelector component', () => {
|
describe('ProjectSelector component', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let vm;
|
let vm;
|
||||||
|
@ -28,7 +26,6 @@ describe('ProjectSelector component', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = mount(Vue.extend(ProjectSelector), {
|
wrapper = mount(Vue.extend(ProjectSelector), {
|
||||||
localVue,
|
|
||||||
propsData: {
|
propsData: {
|
||||||
projectSearchResults: searchResults,
|
projectSearchResults: searchResults,
|
||||||
selectedProjects: selected,
|
selectedProjects: selected,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { GlAlert, GlModal, GlButton, GlLoadingIcon, GlSkeletonLoader } from '@gitlab/ui';
|
import { GlAlert, GlModal, GlButton, GlLoadingIcon, GlSkeletonLoader } from '@gitlab/ui';
|
||||||
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
|
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { nextTick } from 'vue';
|
import Vue, { nextTick } from 'vue';
|
||||||
import VueApollo from 'vue-apollo';
|
import VueApollo from 'vue-apollo';
|
||||||
import createMockApollo from 'helpers/mock_apollo_helper';
|
import createMockApollo from 'helpers/mock_apollo_helper';
|
||||||
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
|
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
|
||||||
|
@ -16,8 +16,7 @@ import {
|
||||||
mockGraphqlInstructionsWindows,
|
mockGraphqlInstructionsWindows,
|
||||||
} from './mock_data';
|
} from './mock_data';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(VueApollo);
|
||||||
localVue.use(VueApollo);
|
|
||||||
|
|
||||||
let resizeCallback;
|
let resizeCallback;
|
||||||
const MockResizeObserver = {
|
const MockResizeObserver = {
|
||||||
|
@ -33,7 +32,7 @@ const MockResizeObserver = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
localVue.directive('gl-resize-observer', MockResizeObserver);
|
Vue.directive('gl-resize-observer', MockResizeObserver);
|
||||||
|
|
||||||
jest.mock('@gitlab/ui/dist/utils');
|
jest.mock('@gitlab/ui/dist/utils');
|
||||||
|
|
||||||
|
@ -67,7 +66,6 @@ describe('RunnerInstructionsModal component', () => {
|
||||||
registrationToken: 'MY_TOKEN',
|
registrationToken: 'MY_TOKEN',
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
localVue,
|
|
||||||
apolloProvider: fakeApollo,
|
apolloProvider: fakeApollo,
|
||||||
...options,
|
...options,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { GlIcon, GlButton } from '@gitlab/ui';
|
import { GlIcon, GlButton } from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
|
||||||
import DropdownButton from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_button.vue';
|
import DropdownButton from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_button.vue';
|
||||||
|
@ -9,8 +10,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
|
||||||
import { mockConfig } from './mock_data';
|
import { mockConfig } from './mock_data';
|
||||||
|
|
||||||
let store;
|
let store;
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
const createComponent = (initialState = mockConfig) => {
|
const createComponent = (initialState = mockConfig) => {
|
||||||
store = new Vuex.Store(labelSelectModule());
|
store = new Vuex.Store(labelSelectModule());
|
||||||
|
@ -18,7 +18,6 @@ const createComponent = (initialState = mockConfig) => {
|
||||||
store.dispatch('setInitialState', initialState);
|
store.dispatch('setInitialState', initialState);
|
||||||
|
|
||||||
return shallowMount(DropdownButton, {
|
return shallowMount(DropdownButton, {
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { GlButton, GlFormInput, GlLink, GlLoadingIcon } from '@gitlab/ui';
|
import { GlButton, GlFormInput, GlLink, GlLoadingIcon } from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
|
||||||
import DropdownContentsCreateView from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue';
|
import DropdownContentsCreateView from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue';
|
||||||
|
@ -8,8 +9,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
|
||||||
|
|
||||||
import { mockConfig, mockSuggestedColors } from './mock_data';
|
import { mockConfig, mockSuggestedColors } from './mock_data';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
const createComponent = (initialState = mockConfig) => {
|
const createComponent = (initialState = mockConfig) => {
|
||||||
const store = new Vuex.Store(labelSelectModule());
|
const store = new Vuex.Store(labelSelectModule());
|
||||||
|
@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
|
||||||
store.dispatch('setInitialState', initialState);
|
store.dispatch('setInitialState', initialState);
|
||||||
|
|
||||||
return shallowMount(DropdownContentsCreateView, {
|
return shallowMount(DropdownContentsCreateView, {
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,8 @@ import {
|
||||||
GlSearchBoxByType,
|
GlSearchBoxByType,
|
||||||
GlLink,
|
GlLink,
|
||||||
} from '@gitlab/ui';
|
} from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import { UP_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESC_KEY_CODE } from '~/lib/utils/keycodes';
|
import { UP_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESC_KEY_CODE } from '~/lib/utils/keycodes';
|
||||||
import DropdownContentsLabelsView from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue';
|
import DropdownContentsLabelsView from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue';
|
||||||
|
@ -18,8 +19,7 @@ import defaultState from '~/vue_shared/components/sidebar/labels_select_vue/stor
|
||||||
|
|
||||||
import { mockConfig, mockLabels, mockRegularLabel } from './mock_data';
|
import { mockConfig, mockLabels, mockRegularLabel } from './mock_data';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
describe('DropdownContentsLabelsView', () => {
|
describe('DropdownContentsLabelsView', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
@ -43,7 +43,6 @@ describe('DropdownContentsLabelsView', () => {
|
||||||
store.dispatch('receiveLabelsSuccess', mockLabels);
|
store.dispatch('receiveLabelsSuccess', mockLabels);
|
||||||
|
|
||||||
wrapper = shallowMount(DropdownContentsLabelsView, {
|
wrapper = shallowMount(DropdownContentsLabelsView, {
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
|
||||||
import { DropdownVariant } from '~/vue_shared/components/sidebar/labels_select_vue/constants';
|
import { DropdownVariant } from '~/vue_shared/components/sidebar/labels_select_vue/constants';
|
||||||
|
@ -7,8 +8,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
|
||||||
|
|
||||||
import { mockConfig } from './mock_data';
|
import { mockConfig } from './mock_data';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
const createComponent = (initialState = mockConfig, propsData = {}) => {
|
const createComponent = (initialState = mockConfig, propsData = {}) => {
|
||||||
const store = new Vuex.Store(labelsSelectModule());
|
const store = new Vuex.Store(labelsSelectModule());
|
||||||
|
@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig, propsData = {}) => {
|
||||||
|
|
||||||
return shallowMount(DropdownContents, {
|
return shallowMount(DropdownContents, {
|
||||||
propsData,
|
propsData,
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { GlButton, GlLoadingIcon } from '@gitlab/ui';
|
import { GlButton, GlLoadingIcon } from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
|
||||||
import DropdownTitle from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_title.vue';
|
import DropdownTitle from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_title.vue';
|
||||||
|
@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
|
||||||
|
|
||||||
import { mockConfig } from './mock_data';
|
import { mockConfig } from './mock_data';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
const createComponent = (initialState = mockConfig) => {
|
const createComponent = (initialState = mockConfig) => {
|
||||||
const store = new Vuex.Store(labelsSelectModule());
|
const store = new Vuex.Store(labelsSelectModule());
|
||||||
|
@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
|
||||||
store.dispatch('setInitialState', initialState);
|
store.dispatch('setInitialState', initialState);
|
||||||
|
|
||||||
return shallowMount(DropdownTitle, {
|
return shallowMount(DropdownTitle, {
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
propsData: {
|
propsData: {
|
||||||
labelsSelectInProgress: false,
|
labelsSelectInProgress: false,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { GlLabel } from '@gitlab/ui';
|
import { GlLabel } from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
|
||||||
import DropdownValue from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue';
|
import DropdownValue from '~/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue';
|
||||||
|
@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
|
||||||
|
|
||||||
import { mockConfig, mockLabels, mockRegularLabel, mockScopedLabel } from './mock_data';
|
import { mockConfig, mockLabels, mockRegularLabel, mockScopedLabel } from './mock_data';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
describe('DropdownValue', () => {
|
describe('DropdownValue', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
@ -23,7 +23,6 @@ describe('DropdownValue', () => {
|
||||||
store.dispatch('setInitialState', { ...mockConfig, ...initialState });
|
store.dispatch('setInitialState', { ...mockConfig, ...initialState });
|
||||||
|
|
||||||
wrapper = shallowMount(DropdownValue, {
|
wrapper = shallowMount(DropdownValue, {
|
||||||
localVue,
|
|
||||||
store,
|
store,
|
||||||
slots,
|
slots,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
|
||||||
import { isInViewport } from '~/lib/utils/common_utils';
|
import { isInViewport } from '~/lib/utils/common_utils';
|
||||||
|
@ -18,8 +19,7 @@ jest.mock('~/lib/utils/common_utils', () => ({
|
||||||
isInViewport: jest.fn().mockReturnValue(true),
|
isInViewport: jest.fn().mockReturnValue(true),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Vuex);
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
describe('LabelsSelectRoot', () => {
|
describe('LabelsSelectRoot', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
@ -27,7 +27,6 @@ describe('LabelsSelectRoot', () => {
|
||||||
|
|
||||||
const createComponent = (config = mockConfig, slots = {}) => {
|
const createComponent = (config = mockConfig, slots = {}) => {
|
||||||
wrapper = shallowMount(LabelsSelectRoot, {
|
wrapper = shallowMount(LabelsSelectRoot, {
|
||||||
localVue,
|
|
||||||
slots,
|
slots,
|
||||||
store,
|
store,
|
||||||
propsData: config,
|
propsData: config,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GlLoadingIcon, GlLink } from '@gitlab/ui';
|
import { GlLoadingIcon, GlLink } from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { nextTick } from 'vue';
|
import Vue, { nextTick } from 'vue';
|
||||||
import VueApollo from 'vue-apollo';
|
import VueApollo from 'vue-apollo';
|
||||||
import createMockApollo from 'helpers/mock_apollo_helper';
|
import createMockApollo from 'helpers/mock_apollo_helper';
|
||||||
import waitForPromises from 'helpers/wait_for_promises';
|
import waitForPromises from 'helpers/wait_for_promises';
|
||||||
|
@ -18,8 +18,7 @@ jest.mock('~/flash');
|
||||||
|
|
||||||
const colors = Object.keys(mockSuggestedColors);
|
const colors = Object.keys(mockSuggestedColors);
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(VueApollo);
|
||||||
localVue.use(VueApollo);
|
|
||||||
|
|
||||||
const userRecoverableError = {
|
const userRecoverableError = {
|
||||||
...createLabelSuccessfulResponse,
|
...createLabelSuccessfulResponse,
|
||||||
|
@ -63,7 +62,6 @@ describe('DropdownContentsCreateView', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper = shallowMount(DropdownContentsCreateView, {
|
wrapper = shallowMount(DropdownContentsCreateView, {
|
||||||
localVue,
|
|
||||||
apolloProvider: mockApollo,
|
apolloProvider: mockApollo,
|
||||||
propsData: {
|
propsData: {
|
||||||
fullPath: '',
|
fullPath: '',
|
||||||
|
|
|
@ -4,8 +4,8 @@ import {
|
||||||
GlDropdownItem,
|
GlDropdownItem,
|
||||||
GlIntersectionObserver,
|
GlIntersectionObserver,
|
||||||
} from '@gitlab/ui';
|
} from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { nextTick } from 'vue';
|
import Vue, { nextTick } from 'vue';
|
||||||
import VueApollo from 'vue-apollo';
|
import VueApollo from 'vue-apollo';
|
||||||
import createMockApollo from 'helpers/mock_apollo_helper';
|
import createMockApollo from 'helpers/mock_apollo_helper';
|
||||||
import waitForPromises from 'helpers/wait_for_promises';
|
import waitForPromises from 'helpers/wait_for_promises';
|
||||||
|
@ -19,8 +19,7 @@ import { mockConfig, workspaceLabelsQueryResponse } from './mock_data';
|
||||||
|
|
||||||
jest.mock('~/flash');
|
jest.mock('~/flash');
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(VueApollo);
|
||||||
localVue.use(VueApollo);
|
|
||||||
|
|
||||||
const localSelectedLabels = [
|
const localSelectedLabels = [
|
||||||
{
|
{
|
||||||
|
@ -47,7 +46,6 @@ describe('DropdownContentsLabelsView', () => {
|
||||||
const mockApollo = createMockApollo([[projectLabelsQuery, queryHandler]]);
|
const mockApollo = createMockApollo([[projectLabelsQuery, queryHandler]]);
|
||||||
|
|
||||||
wrapper = shallowMount(DropdownContentsLabelsView, {
|
wrapper = shallowMount(DropdownContentsLabelsView, {
|
||||||
localVue,
|
|
||||||
apolloProvider: mockApollo,
|
apolloProvider: mockApollo,
|
||||||
provide: {
|
provide: {
|
||||||
variant: DropdownVariant.Sidebar,
|
variant: DropdownVariant.Sidebar,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { GlSearchBoxByType, GlDropdown } from '@gitlab/ui';
|
import { GlSearchBoxByType, GlDropdown } from '@gitlab/ui';
|
||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { nextTick } from 'vue';
|
import Vue, { nextTick } from 'vue';
|
||||||
import VueApollo from 'vue-apollo';
|
import VueApollo from 'vue-apollo';
|
||||||
import createMockApollo from 'helpers/mock_apollo_helper';
|
import createMockApollo from 'helpers/mock_apollo_helper';
|
||||||
import waitForPromises from 'helpers/wait_for_promises';
|
import waitForPromises from 'helpers/wait_for_promises';
|
||||||
|
@ -33,8 +33,7 @@ const waitForSearch = async () => {
|
||||||
await waitForPromises();
|
await waitForPromises();
|
||||||
};
|
};
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(VueApollo);
|
||||||
localVue.use(VueApollo);
|
|
||||||
|
|
||||||
describe('User select dropdown', () => {
|
describe('User select dropdown', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
@ -62,7 +61,6 @@ describe('User select dropdown', () => {
|
||||||
[getIssueParticipantsQuery, participantsQueryHandler],
|
[getIssueParticipantsQuery, participantsQueryHandler],
|
||||||
]);
|
]);
|
||||||
wrapper = shallowMount(UserSelect, {
|
wrapper = shallowMount(UserSelect, {
|
||||||
localVue,
|
|
||||||
apolloProvider: fakeApollo,
|
apolloProvider: fakeApollo,
|
||||||
propsData: {
|
propsData: {
|
||||||
headerText: 'test',
|
headerText: 'test',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { mount, createLocalVue } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VueApollo from 'vue-apollo';
|
import VueApollo from 'vue-apollo';
|
||||||
import VuexModuleProvider from '~/vue_shared/components/vuex_module_provider.vue';
|
import VuexModuleProvider from '~/vue_shared/components/vuex_module_provider.vue';
|
||||||
|
@ -38,10 +38,9 @@ describe('~/vue_shared/components/vuex_module_provider', () => {
|
||||||
|
|
||||||
it('does not blow up when used with vue-apollo', () => {
|
it('does not blow up when used with vue-apollo', () => {
|
||||||
// See https://github.com/vuejs/vue-apollo/pull/1153 for details
|
// See https://github.com/vuejs/vue-apollo/pull/1153 for details
|
||||||
const localVue = createLocalVue();
|
Vue.use(VueApollo);
|
||||||
localVue.use(VueApollo);
|
|
||||||
|
|
||||||
createComponent({ localVue });
|
createComponent();
|
||||||
expect(findProvidedVuexModule()).toBe(TEST_VUEX_MODULE);
|
expect(findProvidedVuexModule()).toBe(TEST_VUEX_MODULE);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import GlFeatureFlags from '~/vue_shared/gl_feature_flags_plugin';
|
import GlFeatureFlags from '~/vue_shared/gl_feature_flags_plugin';
|
||||||
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
|
||||||
|
|
||||||
describe('GitLab Feature Flags Plugin', () => {
|
describe('GitLab Feature Flags Plugin', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
window.gon = {
|
window.gon = {
|
||||||
|
@ -17,7 +16,7 @@ describe('GitLab Feature Flags Plugin', () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
localVue.use(GlFeatureFlags);
|
Vue.use(GlFeatureFlags);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should provide glFeatures to components', () => {
|
it('should provide glFeatures to components', () => {
|
||||||
|
@ -25,7 +24,7 @@ describe('GitLab Feature Flags Plugin', () => {
|
||||||
template: `<span></span>`,
|
template: `<span></span>`,
|
||||||
inject: ['glFeatures'],
|
inject: ['glFeatures'],
|
||||||
};
|
};
|
||||||
const wrapper = shallowMount(component, { localVue });
|
const wrapper = shallowMount(component);
|
||||||
expect(wrapper.vm.glFeatures).toEqual({
|
expect(wrapper.vm.glFeatures).toEqual({
|
||||||
aFeature: true,
|
aFeature: true,
|
||||||
bFeature: false,
|
bFeature: false,
|
||||||
|
@ -39,7 +38,7 @@ describe('GitLab Feature Flags Plugin', () => {
|
||||||
template: `<span></span>`,
|
template: `<span></span>`,
|
||||||
mixins: [glFeatureFlagsMixin()],
|
mixins: [glFeatureFlagsMixin()],
|
||||||
};
|
};
|
||||||
const wrapper = shallowMount(component, { localVue });
|
const wrapper = shallowMount(component);
|
||||||
expect(wrapper.vm.glFeatures).toEqual({
|
expect(wrapper.vm.glFeatures).toEqual({
|
||||||
aFeature: true,
|
aFeature: true,
|
||||||
bFeature: false,
|
bFeature: false,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { mount, createLocalVue } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
|
import Vue from 'vue';
|
||||||
import locale from '~/locale';
|
import locale from '~/locale';
|
||||||
import Translate from '~/vue_shared/translate';
|
import Translate from '~/vue_shared/translate';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
Vue.use(Translate);
|
||||||
localVue.use(Translate);
|
|
||||||
|
|
||||||
describe('Vue translate filter', () => {
|
describe('Vue translate filter', () => {
|
||||||
const createTranslationMock = (key, ...translations) => {
|
const createTranslationMock = (key, ...translations) => {
|
||||||
|
@ -26,16 +26,13 @@ describe('Vue translate filter', () => {
|
||||||
const translation = 'singular_translated';
|
const translation = 'singular_translated';
|
||||||
createTranslationMock(key, translation);
|
createTranslationMock(key, translation);
|
||||||
|
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ __('${key}') }}
|
{{ __('${key}') }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe(translation);
|
expect(wrapper.text()).toBe(translation);
|
||||||
});
|
});
|
||||||
|
@ -45,16 +42,13 @@ describe('Vue translate filter', () => {
|
||||||
const translationPlural = 'plural_multiple translation';
|
const translationPlural = 'plural_multiple translation';
|
||||||
createTranslationMock(key, 'plural_singular translation', translationPlural);
|
createTranslationMock(key, 'plural_singular translation', translationPlural);
|
||||||
|
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ n__('${key}', 'plurals', 2) }}
|
{{ n__('${key}', 'plurals', 2) }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe(translationPlural);
|
expect(wrapper.text()).toBe(translationPlural);
|
||||||
});
|
});
|
||||||
|
@ -67,31 +61,25 @@ describe('Vue translate filter', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('and n === 1', () => {
|
it('and n === 1', () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ n__('${key}', '%d days', 1) }}
|
{{ n__('${key}', '%d days', 1) }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe('1 singular translated');
|
expect(wrapper.text()).toBe('1 singular translated');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('and n > 1', () => {
|
it('and n > 1', () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ n__('${key}', '%d days', 2) }}
|
{{ n__('${key}', '%d days', 2) }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe('2 plural translated');
|
expect(wrapper.text()).toBe('2 plural translated');
|
||||||
});
|
});
|
||||||
|
@ -107,31 +95,25 @@ describe('Vue translate filter', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('and using two parameters', () => {
|
it('and using two parameters', () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ s__('Context', 'Foobar') }}
|
{{ s__('Context', 'Foobar') }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe(expectation);
|
expect(wrapper.text()).toBe(expectation);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('and using the pipe syntax', () => {
|
it('and using the pipe syntax', () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ s__('${key}') }}
|
{{ s__('${key}') }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe(expectation);
|
expect(wrapper.text()).toBe(expectation);
|
||||||
});
|
});
|
||||||
|
@ -141,9 +123,8 @@ describe('Vue translate filter', () => {
|
||||||
const translation = 'multiline string translated';
|
const translation = 'multiline string translated';
|
||||||
createTranslationMock('multiline string', translation);
|
createTranslationMock('multiline string', translation);
|
||||||
|
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ __(\`
|
{{ __(\`
|
||||||
multiline
|
multiline
|
||||||
|
@ -151,9 +132,7 @@ describe('Vue translate filter', () => {
|
||||||
\`) }}
|
\`) }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe(translation);
|
expect(wrapper.text()).toBe(translation);
|
||||||
});
|
});
|
||||||
|
@ -163,9 +142,8 @@ describe('Vue translate filter', () => {
|
||||||
|
|
||||||
createTranslationMock('multiline string', 'multiline string singular', translation);
|
createTranslationMock('multiline string', 'multiline string singular', translation);
|
||||||
|
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ n__(
|
{{ n__(
|
||||||
\`
|
\`
|
||||||
|
@ -180,9 +158,7 @@ describe('Vue translate filter', () => {
|
||||||
) }}
|
) }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe(translation);
|
expect(wrapper.text()).toBe(translation);
|
||||||
});
|
});
|
||||||
|
@ -192,9 +168,8 @@ describe('Vue translate filter', () => {
|
||||||
|
|
||||||
createTranslationMock('Context| multiline string', translation);
|
createTranslationMock('Context| multiline string', translation);
|
||||||
|
|
||||||
const wrapper = mount(
|
const wrapper = mount({
|
||||||
{
|
template: `
|
||||||
template: `
|
|
||||||
<span>
|
<span>
|
||||||
{{ s__(
|
{{ s__(
|
||||||
\`
|
\`
|
||||||
|
@ -205,9 +180,7 @@ describe('Vue translate filter', () => {
|
||||||
) }}
|
) }}
|
||||||
</span>
|
</span>
|
||||||
`,
|
`,
|
||||||
},
|
});
|
||||||
{ localVue },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toBe(translation);
|
expect(wrapper.text()).toBe(translation);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,9 +9,7 @@ RSpec.describe Gitlab::Email::ServiceDeskReceiver do
|
||||||
context 'when the email contains a valid email address' do
|
context 'when the email contains a valid email address' do
|
||||||
before do
|
before do
|
||||||
stub_service_desk_email_setting(enabled: true, address: 'support+%{key}@example.com')
|
stub_service_desk_email_setting(enabled: true, address: 'support+%{key}@example.com')
|
||||||
end
|
|
||||||
|
|
||||||
it 'finds the service desk key' do
|
|
||||||
handler = double(execute: true, metrics_event: true, metrics_params: true)
|
handler = double(execute: true, metrics_event: true, metrics_params: true)
|
||||||
expected_params = [
|
expected_params = [
|
||||||
an_instance_of(Mail::Message), nil,
|
an_instance_of(Mail::Message), nil,
|
||||||
|
@ -20,8 +18,38 @@ RSpec.describe Gitlab::Email::ServiceDeskReceiver do
|
||||||
|
|
||||||
expect(Gitlab::Email::Handler::ServiceDeskHandler)
|
expect(Gitlab::Email::Handler::ServiceDeskHandler)
|
||||||
.to receive(:new).with(*expected_params).and_return(handler)
|
.to receive(:new).with(*expected_params).and_return(handler)
|
||||||
|
end
|
||||||
|
|
||||||
receiver.execute
|
context 'when in a To header' do
|
||||||
|
it 'finds the service desk key' do
|
||||||
|
receiver.execute
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the email contains a valid email address in a header' do
|
||||||
|
context 'when in a Delivered-To header' do
|
||||||
|
let(:email) { fixture_file('emails/service_desk_custom_address_reply.eml') }
|
||||||
|
|
||||||
|
it 'finds the service desk key' do
|
||||||
|
receiver.execute
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when in a Envelope-To header' do
|
||||||
|
let(:email) { fixture_file('emails/service_desk_custom_address_envelope_to.eml') }
|
||||||
|
|
||||||
|
it 'finds the service desk key' do
|
||||||
|
receiver.execute
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when in a X-Envelope-To header' do
|
||||||
|
let(:email) { fixture_file('emails/service_desk_custom_address_x_envelope_to.eml') }
|
||||||
|
|
||||||
|
it 'finds the service desk key' do
|
||||||
|
receiver.execute
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue