diff options
Diffstat (limited to 'spec')
4 files changed, 16 insertions, 7 deletions
diff --git a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js b/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js index 99cb864ce34..dc25c7647b8 100644 --- a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js +++ b/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js @@ -1,6 +1,7 @@ import Vuex from 'vuex'; import { shallowMount, createLocalVue } from '@vue/test-utils'; import { GlDeprecatedDropdownItem, GlDropdown } from '@gitlab/ui'; +import { secondsToHours } from '~/lib/utils/datetime_utility'; import TimezoneDropdown from '~/vue_shared/components/timezone_dropdown.vue'; import createStore from '~/deploy_freeze/store'; @@ -12,6 +13,11 @@ describe('Deploy freeze timezone dropdown', () => { let store; const timezoneDataFixture = getJSONFixture('/api/freeze-periods/timezone_data.json'); + const findTzByName = (identifier = '') => + timezoneDataFixture.find(({ name }) => name.toLowerCase() === identifier.toLowerCase()); + + const formatTz = ({ offset, name }) => `[UTC ${secondsToHours(offset)}] ${name}`; + const createComponent = (searchTerm, selectedTimezone) => { store = createStore({ projectId: '8', @@ -63,8 +69,9 @@ describe('Deploy freeze timezone dropdown', () => { }); it('renders only the time zone searched for', () => { + const selectedTz = findTzByName('Alaska'); expect(findAllDropdownItems()).toHaveLength(1); - expect(findDropdownItemByIndex(0).text()).toBe('[UTC -8] Alaska'); + expect(findDropdownItemByIndex(0).text()).toBe(formatTz(selectedTz)); }); it('should not display empty results message', () => { @@ -72,13 +79,15 @@ describe('Deploy freeze timezone dropdown', () => { }); describe('Custom events', () => { + const selectedTz = findTzByName('Alaska'); + it('should emit input if a time zone is clicked', () => { findDropdownItemByIndex(0).vm.$emit('click'); expect(wrapper.emitted('input')).toEqual([ [ { - formattedTimezone: '[UTC -8] Alaska', - identifier: 'America/Juneau', + formattedTimezone: formatTz(selectedTz), + identifier: selectedTz.identifier, }, ], ]); diff --git a/spec/models/clusters/applications/fluentd_spec.rb b/spec/models/clusters/applications/fluentd_spec.rb index be7b4a87947..3bda3e99ec1 100644 --- a/spec/models/clusters/applications/fluentd_spec.rb +++ b/spec/models/clusters/applications/fluentd_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Clusters::Applications::Fluentd do it 'is initialized with fluentd arguments' do expect(subject.name).to eq('fluentd') - expect(subject.chart).to eq('stable/fluentd') + expect(subject.chart).to eq('fluentd/fluentd') expect(subject.version).to eq('2.4.0') expect(subject).to be_rbac end diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb index e029283326f..196d57aff7b 100644 --- a/spec/models/clusters/applications/ingress_spec.rb +++ b/spec/models/clusters/applications/ingress_spec.rb @@ -135,7 +135,7 @@ RSpec.describe Clusters::Applications::Ingress do it 'is initialized with ingress arguments' do expect(subject.name).to eq('ingress') - expect(subject.chart).to eq('stable/nginx-ingress') + expect(subject.chart).to eq('ingress/nginx-ingress') expect(subject.version).to eq('1.40.2') expect(subject).to be_rbac expect(subject.files).to eq(ingress.files) diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb index 82971596176..b450900bee6 100644 --- a/spec/models/clusters/applications/prometheus_spec.rb +++ b/spec/models/clusters/applications/prometheus_spec.rb @@ -152,7 +152,7 @@ RSpec.describe Clusters::Applications::Prometheus do it 'is initialized with 3 arguments' do expect(subject.name).to eq('prometheus') - expect(subject.chart).to eq('stable/prometheus') + expect(subject.chart).to eq('prometheus/prometheus') expect(subject.version).to eq('10.4.1') expect(subject).to be_rbac expect(subject.files).to eq(prometheus.files) @@ -240,7 +240,7 @@ RSpec.describe Clusters::Applications::Prometheus do it 'is initialized with 3 arguments' do expect(patch_command.name).to eq('prometheus') - expect(patch_command.chart).to eq('stable/prometheus') + expect(patch_command.chart).to eq('prometheus/prometheus') expect(patch_command.version).to eq('10.4.1') expect(patch_command.files).to eq(prometheus.files) end |