Commit 4e26ed13 authored by Fernando's avatar Fernando

Fix modal rule create unit tests

* Update specs
parent 6725cb1f
......@@ -25,9 +25,9 @@ export default {
rule: 'data',
}),
title() {
return this.rule && !this.rule.defaultRuleName
? __('Update approval rule')
: __('Add approval rule');
return !this.rule || this.defaultRuleName
? __('Add approval rule')
: __('Update approval rule');
},
defaultRuleName() {
return this.rule && this.rule.defaultRuleName;
......
......@@ -102,7 +102,7 @@ describe('Approvals ModalRuleCreate', () => {
describe('with approvalSuggestions feature flag', () => {
beforeEach(() => {
createModalState.data = { ...TEST_RULE, initRuleField: true, name: 'Vulnerability-Check' };
createModalState.data = { ...TEST_RULE, defaultRuleName: 'Vulnerability-Check' };
factory({
provide: {
......@@ -119,14 +119,14 @@ describe('Approvals ModalRuleCreate', () => {
expect(modal.attributes('ok-title')).toEqual('Add approval rule');
});
it('renders form with initRuleFieldName', () => {
expect(form.props().initRuleFieldName).toBe('Vulnerability-Check');
it('renders form with defaultRuleName', () => {
expect(form.props().defaultRuleName).toBe('Vulnerability-Check');
expect(form.exists()).toBe(true);
});
it('renders the form without passing in an existing rule', () => {
it('renders the form when passing in an existing rule', () => {
expect(form.exists()).toBe(true);
expect(form.props('initRule')).toBeNull();
expect(form.props('initRule')).toEqual(createModalState.data);
});
});
});
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