[CST-7694] fixed group edit issue for non permanent group

This commit is contained in:
Nikunj Sharma
2022-11-24 14:17:50 +05:30
parent 89447a6c32
commit e7607da0a2
2 changed files with 39 additions and 2 deletions

View File

@@ -266,6 +266,43 @@ describe('GroupFormComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should edit with name and description operations', () => {
const operations = [{
op: 'add',
path: '/metadata/dc.description',
value: 'testDescription'
}, {
op: 'replace',
path: '/name',
value: 'newGroupName'
}];
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
});
it('should edit with description operations', () => {
component.groupName.value = null;
component.onSubmit();
fixture.detectChanges();
const operations = [{
op: 'add',
path: '/metadata/dc.description',
value: 'testDescription'
}];
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
});
it('should edit with name operations', () => {
component.groupDescription.value = null;
component.onSubmit();
fixture.detectChanges();
const operations = [{
op: 'replace',
path: '/name',
value: 'newGroupName'
}];
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
});
it('should emit the existing group using the correct new values', waitForAsync(() => { it('should emit the existing group using the correct new values', waitForAsync(() => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
expect(component.submitForm.emit).toHaveBeenCalledWith(expected2); expect(component.submitForm.emit).toHaveBeenCalledWith(expected2);

View File

@@ -344,8 +344,8 @@ export class GroupFormComponent implements OnInit, OnDestroy {
if (hasValue(this.groupDescription.value)) { if (hasValue(this.groupDescription.value)) {
operations = [...operations, { operations = [...operations, {
op: 'replace', op: 'add',
path: '/metadata/dc.description/0/value', path: '/metadata/dc.description',
value: this.groupDescription.value value: this.groupDescription.value
}]; }];
} }