Commit 6725cb1f authored by Fernando's avatar Fernando

Update remaining unit tests

* Update unti tests to account for component refactor
parent d9739651
...@@ -10,7 +10,7 @@ export const createStoreOptions = (approvalsModule, settings) => ({ ...@@ -10,7 +10,7 @@ export const createStoreOptions = (approvalsModule, settings) => ({
createModal: modalModule(), createModal: modalModule(),
deleteModal: modalModule(), deleteModal: modalModule(),
securityConfiguration: securityConfigurationModule({ securityConfiguration: securityConfigurationModule({
securityConfigurationPath: settings.securityConfigurationPath, securityConfigurationPath: settings?.securityConfigurationPath || '',
}), }),
}, },
}); });
......
...@@ -5,7 +5,7 @@ import projectSettingsModule from 'ee/approvals/stores/modules/project_settings' ...@@ -5,7 +5,7 @@ import projectSettingsModule from 'ee/approvals/stores/modules/project_settings'
import ProjectRules from 'ee/approvals/components/project_settings/project_rules.vue'; import ProjectRules from 'ee/approvals/components/project_settings/project_rules.vue';
import RuleInput from 'ee/approvals/components/mr_edit/rule_input.vue'; import RuleInput from 'ee/approvals/components/mr_edit/rule_input.vue';
import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue'; import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue';
import UnconfiguredSecurityRule from 'ee/approvals/components/security_configuration/unconfigured_security_rule.vue'; import UnconfiguredSecurityRules from 'ee/approvals/components/security_configuration/unconfigured_security_rules.vue';
import { createProjectRules } from '../../mocks'; import { createProjectRules } from '../../mocks';
const TEST_RULES = createProjectRules(); const TEST_RULES = createProjectRules();
...@@ -125,7 +125,7 @@ describe('Approvals ProjectRules', () => { ...@@ -125,7 +125,7 @@ describe('Approvals ProjectRules', () => {
}); });
it('should not render the unconfigured-security-rule component', () => { it('should not render the unconfigured-security-rule component', () => {
expect(wrapper.contains(UnconfiguredSecurityRule)).toBe(false); expect(wrapper.contains(UnconfiguredSecurityRules)).toBe(false);
}); });
}); });
...@@ -149,7 +149,31 @@ describe('Approvals ProjectRules', () => { ...@@ -149,7 +149,31 @@ describe('Approvals ProjectRules', () => {
}); });
it('should render the unconfigured-security-rule component', () => { it('should render the unconfigured-security-rule component', () => {
expect(wrapper.contains(UnconfiguredSecurityRule)).toBe(true); expect(wrapper.contains(UnconfiguredSecurityRules)).toBe(true);
});
});
describe('when the approvalSuggestions feature flag is disabled', () => {
beforeEach(() => {
const rules = createProjectRules();
rules[0].name = 'Vulnerability-Check';
store.modules.approvals.state.rules = rules;
store.state.settings.allowMultiRule = true;
});
beforeEach(() => {
factory(
{},
{
provide: {
glFeatures: { approvalSuggestions: false },
},
},
);
});
it('should notrender the unconfigured-security-rule component', () => {
expect(wrapper.contains(UnconfiguredSecurityRules)).toBe(false);
}); });
}); });
}); });
...@@ -488,7 +488,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -488,7 +488,7 @@ describe('EE Approvals RuleForm', () => {
createComponent( createComponent(
{ {
initRule: null, initRule: null,
initRuleFieldName: 'Vulnerability-Check', defaultRuleName: 'Vulnerability-Check',
}, },
{ {
provide: { provide: {
...@@ -508,7 +508,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -508,7 +508,7 @@ describe('EE Approvals RuleForm', () => {
createComponent( createComponent(
{ {
initRule: null, initRule: null,
initRuleFieldName: 'License-Check', defaultRuleName: 'License-Check',
}, },
{ {
provide: { provide: {
...@@ -528,7 +528,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -528,7 +528,7 @@ describe('EE Approvals RuleForm', () => {
createComponent( createComponent(
{ {
initRule: null, initRule: null,
initRuleFieldName: 'Foo Bar Baz', defaultRuleName: 'Foo Bar Baz',
}, },
{ {
provide: { provide: {
......
...@@ -11,25 +11,8 @@ describe('security configuration module actions', () => { ...@@ -11,25 +11,8 @@ describe('security configuration module actions', () => {
let state; let state;
beforeEach(() => { beforeEach(() => {
state = createState(); state = createState({
}); securityConfigurationPath: `${TEST_HOST}/-/security/configuration.json`,
describe('setSecurityConfigurationEndpoint', () => {
const securityConfigurationPath = 123;
it('should commit the SET_SECURITY_CONFIGURATION_ENDPOINT mutation', async () => {
await testAction(
actions.setSecurityConfigurationEndpoint,
securityConfigurationPath,
state,
[
{
type: types.SET_SECURITY_CONFIGURATION_ENDPOINT,
payload: securityConfigurationPath,
},
],
[],
);
}); });
}); });
...@@ -38,7 +21,6 @@ describe('security configuration module actions', () => { ...@@ -38,7 +21,6 @@ describe('security configuration module actions', () => {
const configuration = {}; const configuration = {};
beforeEach(() => { beforeEach(() => {
state.securityConfigurationPath = `${TEST_HOST}/-/security/configuration.json`;
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
}); });
......
...@@ -8,15 +8,6 @@ describe('security configuration module mutations', () => { ...@@ -8,15 +8,6 @@ describe('security configuration module mutations', () => {
state = {}; state = {};
}); });
describe('SET_SECURITY_CONFIGURATION_ENDPOINT', () => {
const securityConfigurationPath = 123;
it(`should set the securityConfigurationPath to ${securityConfigurationPath}`, () => {
mutations[types.SET_SECURITY_CONFIGURATION_ENDPOINT](state, securityConfigurationPath);
expect(state.securityConfigurationPath).toBe(securityConfigurationPath);
});
});
describe('REQUEST_SECURITY_CONFIGURATION', () => { describe('REQUEST_SECURITY_CONFIGURATION', () => {
it('should set the isLoading to true', () => { it('should set the isLoading to true', () => {
mutations[types.REQUEST_SECURITY_CONFIGURATION](state); mutations[types.REQUEST_SECURITY_CONFIGURATION](state);
......
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