mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 02:28:50 -05:00
d65bba566c
[web] Show Group SSO linking status on the account settings page GitOrigin-RevId: ae45e1bd7a90a672c5fb023e7f3e603a00e364e5
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import SecuritySection from '@/features/settings/components/security-section'
|
|
import { expect } from 'chai'
|
|
import { screen, render } from '@testing-library/react'
|
|
import fetchMock from 'fetch-mock'
|
|
|
|
describe('<SecuritySection />', function () {
|
|
beforeEach(function () {
|
|
window.metaAttributesCache = window.metaAttributesCache || new Map()
|
|
})
|
|
|
|
afterEach(function () {
|
|
window.metaAttributesCache = new Map()
|
|
fetchMock.reset()
|
|
})
|
|
|
|
it('shows Group SSO rows in security section', async function () {
|
|
window.metaAttributesCache.set('ol-memberOfSSOEnabledGroups', [
|
|
{
|
|
groupId: 'abc123abc123',
|
|
linked: true,
|
|
},
|
|
{
|
|
groupId: 'fff999fff999',
|
|
linked: false,
|
|
},
|
|
])
|
|
render(<SecuritySection />)
|
|
|
|
expect(screen.getAllByText('Single Sign-On (SSO)').length).to.equal(2)
|
|
const link = screen.getByRole('link', {
|
|
name: /Set up SSO/i,
|
|
})
|
|
expect(link).to.exist
|
|
expect(link.getAttribute('href')).to.equal(
|
|
'/subscription/fff999fff999/sso_enrollment'
|
|
)
|
|
})
|
|
|
|
it('does not show the security section with no groups with SSO enabled', async function () {
|
|
window.metaAttributesCache.set('ol-memberOfSSOEnabledGroups', [])
|
|
render(<SecuritySection />)
|
|
|
|
expect(screen.queryByText('Security')).to.not.exist
|
|
})
|
|
})
|