mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 07:34:20 -05:00
c6b88085d5
[web] Migrate team invite to React GitOrigin-RevId: 32e968c3b512020aef9a396808c73a7b4859e6d1
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import AcceptedInvite from '../../../../../../frontend/js/features/subscription/components/group-invite/accepted-invite'
|
|
import { expect } from 'chai'
|
|
|
|
describe('accepted group invite', function () {
|
|
afterEach(function () {
|
|
window.metaAttributesCache = new Map()
|
|
})
|
|
|
|
it('renders', async function () {
|
|
window.metaAttributesCache.set('ol-inviterName', 'example@overleaf.com')
|
|
render(<AcceptedInvite />)
|
|
await screen.findByText(
|
|
'You have joined the group subscription managed by example@overleaf.com'
|
|
)
|
|
})
|
|
|
|
it('links to SSO enrollment page for SSO groups', async function () {
|
|
window.metaAttributesCache.set('ol-inviterName', 'example@overleaf.com')
|
|
window.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
window.metaAttributesCache.set('ol-subscriptionId', 'group123')
|
|
render(<AcceptedInvite />)
|
|
const linkBtn = (await screen.findByRole('link', {
|
|
name: 'Done',
|
|
})) as HTMLLinkElement
|
|
expect(linkBtn.href).to.equal(
|
|
'https://www.test-overleaf.com/subscription/group123/sso_enrollment'
|
|
)
|
|
})
|
|
|
|
it('links to dash for non-SSO groups', async function () {
|
|
window.metaAttributesCache.set('ol-inviterName', 'example@overleaf.com')
|
|
render(<AcceptedInvite />)
|
|
const linkBtn = (await screen.findByRole('link', {
|
|
name: 'Done',
|
|
})) as HTMLLinkElement
|
|
expect(linkBtn.href).to.equal('https://www.test-overleaf.com/project')
|
|
})
|
|
})
|