Skip to content

Commit 3385308

Browse files
committed
revert(test/router): remove tests for policies access guard
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 3e18618 commit 3385308

1 file changed

Lines changed: 0 additions & 51 deletions

File tree

src/tests/router/router.spec.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -326,55 +326,4 @@ describe('router business rules', () => {
326326
})
327327
})
328328

329-
describe('policies route access guard', () => {
330-
it('redirects to Preferences when user cannot manage policies', () => {
331-
loadState.mockImplementation((app, key, defaultValue) => {
332-
if (key === 'config') {
333-
return { can_manage_group_policies: false }
334-
}
335-
if (key === 'effective_policies') {
336-
return { policies: {} }
337-
}
338-
return defaultValue
339-
})
340-
341-
const route = getRoutes().find((r: RouteRecordNormalized) => r.name === 'Policies')
342-
expect(route).toBeDefined()
343-
expect(route?.beforeEnter).toBeDefined()
344-
345-
const guard = route?.beforeEnter as (to: RouteLocationNormalized, from: RouteLocationNormalized) => unknown
346-
const result = guard(makeRoute({ path: '/f/policies' }), makeRoute({ path: '/f/account' }))
347-
348-
expect(result).toEqual({ name: 'Preferences' })
349-
})
350-
351-
it('allows Policies when delegated editable policies exist for a group admin', () => {
352-
loadState.mockImplementation((app, key, defaultValue) => {
353-
if (key === 'config') {
354-
return { can_manage_group_policies: true }
355-
}
356-
if (key === 'effective_policies') {
357-
return {
358-
policies: {
359-
signature_flow: {
360-
groupCount: 1,
361-
userCount: 0,
362-
editableByCurrentActor: true,
363-
},
364-
},
365-
}
366-
}
367-
return defaultValue
368-
})
369-
370-
const route = getRoutes().find((r: RouteRecordNormalized) => r.name === 'Policies')
371-
expect(route).toBeDefined()
372-
expect(route?.beforeEnter).toBeDefined()
373-
374-
const guard = route?.beforeEnter as (to: RouteLocationNormalized, from: RouteLocationNormalized) => unknown
375-
const result = guard(makeRoute({ path: '/f/policies' }), makeRoute({ path: '/f/account' }))
376-
377-
expect(result).toBe(true)
378-
})
379-
})
380329
})

0 commit comments

Comments
 (0)