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) => ({
createModal: modalModule(),
deleteModal: modalModule(),
securityConfiguration: securityConfigurationModule({
securityConfigurationPath: settings.securityConfigurationPath,
securityConfigurationPath: settings?.securityConfigurationPath || '',
}),
},
});
......
......@@ -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 RuleInput from 'ee/approvals/components/mr_edit/rule_input.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';
const TEST_RULES = createProjectRules();
......@@ -125,7 +125,7 @@ describe('Approvals ProjectRules', () => {
});
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', () => {
});
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', () => {
createComponent(
{
initRule: null,
initRuleFieldName: 'Vulnerability-Check',
defaultRuleName: 'Vulnerability-Check',
},
{
provide: {
......@@ -508,7 +508,7 @@ describe('EE Approvals RuleForm', () => {
createComponent(
{
initRule: null,
initRuleFieldName: 'License-Check',
defaultRuleName: 'License-Check',
},
{
provide: {
......@@ -528,7 +528,7 @@ describe('EE Approvals RuleForm', () => {
createComponent(
{
initRule: null,
initRuleFieldName: 'Foo Bar Baz',
defaultRuleName: 'Foo Bar Baz',
},
{
provide: {
......
......@@ -11,25 +11,8 @@ describe('security configuration module actions', () => {
let state;
beforeEach(() => {
state = createState();
});
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,
},
],
[],
);
state = createState({
securityConfigurationPath: `${TEST_HOST}/-/security/configuration.json`,
});
});
......@@ -38,7 +21,6 @@ describe('security configuration module actions', () => {
const configuration = {};
beforeEach(() => {
state.securityConfigurationPath = `${TEST_HOST}/-/security/configuration.json`;
mock = new MockAdapter(axios);
});
......
......@@ -8,15 +8,6 @@ describe('security configuration module mutations', () => {
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', () => {
it('should set the isLoading to true', () => {
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