Skip to content

Commit 1966ffc

Browse files
committed
test(settings): require delegated rules for policies menu
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent e31a789 commit 1966ffc

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/tests/components/Settings/Settings.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ describe('Settings', () => {
403403
wrapper = createWrapper(false, true, {
404404
signature_flow: {
405405
editableByCurrentActor: true,
406+
groupCount: 1,
407+
userCount: 0,
406408
},
407409
})
408410
const items = getItems()
@@ -411,6 +413,19 @@ describe('Settings', () => {
411413
expect(policiesItem.props('to')).toEqual({ name: 'Policies' })
412414
})
413415

416+
it('hides Policies for non-admin users when only system-level editable policies exist', () => {
417+
wrapper = createWrapper(false, true, {
418+
docmdp: {
419+
editableByCurrentActor: true,
420+
groupCount: 0,
421+
userCount: 0,
422+
},
423+
})
424+
const items = getItems()
425+
426+
expect(findItemByName(items, 'Policies')).toBeUndefined()
427+
})
428+
414429
it('renders the policies icon for admin users', () => {
415430
wrapper = createWrapper(true)
416431

@@ -601,6 +616,8 @@ describe('Settings', () => {
601616
wrapper = createWrapper(false, true, {
602617
signature_flow: {
603618
editableByCurrentActor: true,
619+
groupCount: 1,
620+
userCount: 0,
604621
},
605622
})
606623
const items = getItems()

0 commit comments

Comments
 (0)