fix(ui): keep policy rule operations in sync with server#27694
fix(ui): keep policy rule operations in sync with server#27694nehaaprasaad wants to merge 1 commit intoopen-metadata:mainfrom
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| describe('PolicyRuleUtils', () => { | ||
| it('keeps ViewBasic when it is the only view operation', () => { | ||
| const result = filterRedundantPolicyOperations([Operation.ViewBasic]); | ||
| expect(result).toEqual([Operation.ViewBasic]); | ||
| }); | ||
|
|
||
| it('removes other view operations when ViewAll is present', () => { | ||
| const result = filterRedundantPolicyOperations([ | ||
| Operation.Create, | ||
| Operation.ViewAll, | ||
| Operation.ViewBasic, | ||
| Operation.ViewUsage, | ||
| ]); | ||
| expect(result).toEqual([Operation.Create, Operation.ViewAll]); | ||
| }); |
There was a problem hiding this comment.
💡 Quality: Unit tests missing coverage for EditAll filtering path
The PolicyRuleUtils.test.ts file only tests ViewAll/ViewBasic scenarios but has no test for the EditAll branch of filterRedundantPolicyOperations. Since the function has two independent filter paths (ViewAll and EditAll), both should be exercised to prevent regressions.
Suggested fix:
Add tests for EditAll filtering, e.g.:
it('removes other edit operations when EditAll is present', () => {
const result = filterRedundantPolicyOperations([
Operation.ViewBasic,
Operation.EditAll,
Operation.EditDescription,
Operation.EditTags,
]);
expect(result).toEqual([Operation.ViewBasic, Operation.EditAll]);
});
it('handles both ViewAll and EditAll together', () => {
const result = filterRedundantPolicyOperations([
Operation.ViewAll,
Operation.ViewBasic,
Operation.EditAll,
Operation.EditTags,
]);
expect(result).toEqual([Operation.ViewAll, Operation.EditAll]);
});
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsSynchronizes UI policy rule operations with server-side state for improved consistency. Add unit tests for the EditAll filtering path to ensure complete test coverage. 💡 Quality: Unit tests missing coverage for EditAll filtering path📄 openmetadata-ui/src/main/resources/ui/src/utils/PolicyRuleUtils.test.ts:17-31 The Suggested fix🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Describe your changes
fix : #27591
Type of change
Checklist
[x] CONTRIBUTING
[x] Bug fix test (IT + unit)