Skip to content
Snippets Groups Projects
Commit 6b8d671d authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 163a7046
No related branches found
No related tags found
No related merge requests found
import state from '~/ci_variable_list/store/state';
import mutations from '~/ci_variable_list/store/mutations';
import * as types from '~/ci_variable_list/store/mutation_types';
describe('CI variable list mutations', () => {
let stateCopy;
beforeEach(() => {
stateCopy = state();
});
describe('TOGGLE_VALUES', () => {
it('should toggle state', () => {
const valuesHidden = false;
mutations[types.TOGGLE_VALUES](stateCopy, valuesHidden);
expect(stateCopy.valuesHidden).toEqual(valuesHidden);
});
});
describe('VARIABLE_BEING_EDITED', () => {
it('should set variable that is being edited', () => {
const variableBeingEdited = {
environment_scope: '*',
id: 63,
key: 'test_var',
masked: false,
protected: false,
value: 'test_val',
variable_type: 'env_var',
};
mutations[types.VARIABLE_BEING_EDITED](stateCopy, variableBeingEdited);
expect(stateCopy.variableBeingEdited).toEqual(variableBeingEdited);
});
});
describe('RESET_EDITING', () => {
it('should reset variableBeingEdited to null', () => {
mutations[types.RESET_EDITING](stateCopy);
expect(stateCopy.variableBeingEdited).toEqual(null);
});
});
describe('CLEAR_MODAL', () => {
it('should clear modal state ', () => {
const modalState = {
variable_type: 'Variable',
key: '',
secret_value: '',
protected: false,
masked: false,
environment_scope: 'All environments',
};
mutations[types.CLEAR_MODAL](stateCopy);
expect(stateCopy.variable).toEqual(modalState);
});
});
});
import {
prepareDataForDisplay,
prepareEnvironments,
prepareDataForApi,
} from '~/ci_variable_list/store/utils';
import mockData from '../services/mock_data';
describe('CI variables store utils', () => {
it('prepares ci variables for display', () => {
expect(prepareDataForDisplay(mockData.mockVariablesApi)).toStrictEqual(
mockData.mockVariablesDisplay,
);
});
it('prepares single ci variable for api', () => {
expect(prepareDataForApi(mockData.mockVariablesDisplay[0])).toStrictEqual({
environment_scope: '*',
id: 113,
key: 'test_var',
masked: false,
protected: false,
value: 'test_val',
variable_type: 'env_var',
});
expect(prepareDataForApi(mockData.mockVariablesDisplay[1])).toStrictEqual({
environment_scope: '*',
id: 114,
key: 'test_var_2',
masked: false,
protected: false,
value: 'test_val_2',
variable_type: 'file',
});
});
it('prepares single ci variable for delete', () => {
expect(prepareDataForApi(mockData.mockVariablesDisplay[0], true)).toHaveProperty(
'_destroy',
true,
);
});
it('prepares environments for display', () => {
expect(prepareEnvironments(mockData.mockEnvironments)).toStrictEqual(['staging', 'production']);
});
});
Loading
Loading
@@ -38,7 +38,7 @@ RSpec.describe Quality::KubernetesClient do
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
 
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(kubectl delete --namespace "#{namespace}" #{pod_for_release})])
.with([%(kubectl delete --namespace "#{namespace}" --ignore-not-found #{pod_for_release})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
 
# We're not verifying the output here, just silencing it
Loading
Loading
@@ -64,7 +64,7 @@ RSpec.describe Quality::KubernetesClient do
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
 
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(kubectl delete --namespace "#{namespace}" #{pod_for_release})])
.with([%(kubectl delete --namespace "#{namespace}" --ignore-not-found #{pod_for_release})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
 
# We're not verifying the output here, just silencing it
Loading
Loading
@@ -89,7 +89,7 @@ RSpec.describe Quality::KubernetesClient do
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
 
expect(Gitlab::Popen).to receive(:popen_with_detail)
.with([%(kubectl delete --namespace "#{namespace}" #{pod_for_release})])
.with([%(kubectl delete --namespace "#{namespace}" --ignore-not-found #{pod_for_release})])
.and_return(Gitlab::Popen::Result.new([], '', '', double(success?: true)))
 
# We're not verifying the output here, just silencing it
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment