:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
import { urls } from 'scenes/urls'
import { initKeaTests } from '~/test/init'
import { roleAccessControlLogic } from './roleAccessControlLogic'
describe('roleAccessControlLogic', () => {
let logic: ReturnType<typeof roleAccessControlLogic.build>
beforeEach(() => {
initKeaTests()
router.actions.push(urls.settings('organization-roles'), {}, { role: 'role-a' })
logic = roleAccessControlLogic()
logic.mount()
})
afterEach(() => {
logic.unmount()
})
it('syncs the selected role with the role in the URL hash', async () => {
await expectLogic(logic).toMatchValues({ selectedRoleId: 'role-a' })
router.actions.push(urls.settings('organization-roles'), {}, { role: 'role-b' })
await expectLogic(logic).toMatchValues({ selectedRoleId: 'role-b' })
router.actions.push(urls.settings('organization-roles'))
await expectLogic(logic).toMatchValues({ selectedRoleId: null })
})
})