Skip to content

Commit

Permalink
[ACA-4627] Folder Rules - clicking on Manage Rules button does not fi…
Browse files Browse the repository at this point in the history
…re the correct requests to the backend for inherited rules (#2822)

* ACA-4627 - changed from parent id to the current folder id

* ACA-4627 - unit test
  • Loading branch information
nikita-web-ua committed Nov 30, 2022
1 parent bfe14f8 commit 5d330d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('FolderRuleSetsService', () => {
let contentApiService: ContentApiService;

let callApiSpy: jasmine.Spy;
let getRulesSpy: jasmine.Spy;
let getNodeSpy: jasmine.Spy;

beforeEach(() => {
Expand All @@ -57,7 +58,7 @@ describe('FolderRuleSetsService', () => {
.and.returnValue(of(getDefaultRuleSetResponseMock))
.withArgs(`/nodes/${owningFolderIdMock}/rule-sets?include=isLinkedTo,owningFolder,linkedToBy&skipCount=0&maxItems=100`, 'GET')
.and.returnValue(of(getRuleSetsResponseMock));
spyOn<any>(folderRulesService, 'getRules')
getRulesSpy = spyOn<any>(folderRulesService, 'getRules')
.withArgs(jasmine.anything(), 'rule-set-no-links')
.and.returnValue(of({ rules: ownedRulesMock, hasMoreRules: false }))
.withArgs(jasmine.anything(), 'rule-set-with-link')
Expand Down Expand Up @@ -108,6 +109,7 @@ describe('FolderRuleSetsService', () => {
'GET'
);
expect(ruleSets).toEqual([inheritedRuleSetMock]);
expect(getRulesSpy).toHaveBeenCalledWith(owningFolderIdMock, jasmine.anything());
expect(hasMoreRuleSets).toEqual(false);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class FolderRuleSetsService {
}
return combineLatest(
this.currentFolder?.id === entry.owningFolder ? of(this.currentFolder) : this.getNodeInfo(entry.owningFolder || ''),
this.folderRulesService.getRules(entry.owningFolder || '', entry.id)
this.folderRulesService.getRules(this.currentFolder.id || '', entry.id)
).pipe(
map(([owningFolderNodeInfo, getRulesRes]) => ({
id: entry.id,
Expand Down

0 comments on commit 5d330d3

Please sign in to comment.