Merge pull request #28522 from overleaf/ii-domain-capture-create-user-notification

[web] Success message when linking to group with domain capture

GitOrigin-RevId: 2abf29b486da5043c9f207b8f1f741a3c3ee54ab
This commit is contained in:
ilkin-overleaf
2025-09-24 08:06:29 +00:00
committed by Copybot
parent 1b24774394
commit dfd6c8b007
6 changed files with 76 additions and 4 deletions
@@ -509,8 +509,43 @@ describe('<UserNotifications />', function () {
render(<Institution />)
fetchMock.delete(`/notifications/${institution._id}`, 200)
screen.getByRole('alert')
screen.getByText(/has been linked to your/i)
const notificationEl = screen.getByRole('alert')
expect(notificationEl.textContent).to.match(
new RegExp(
`your Overleaf account on ${notificationsInstitution.email} ` +
`has been linked to your ${notificationsInstitution.institutionName} ` +
`institutional account.`,
'i'
)
)
const closeBtn = screen.getByRole('button', { name: /close/i })
fireEvent.click(closeBtn)
expect(fetchMock.callHistory.called()).to.be.true
expect(screen.queryByRole('alert')).to.be.null
})
it('shows sso linked to group with domain capture enabled', function () {
const institution: DeepPartial<InstitutionType> = {
_id: 1,
templateKey: 'notification_group_sso_linked',
}
window.metaAttributesCache.set('ol-notificationsInstitution', [
{ ...notificationsInstitution, ...institution },
])
render(<Institution />)
fetchMock.delete(`/notifications/${institution._id}`, 200)
const notificationEl = screen.getByRole('alert')
expect(notificationEl.textContent).to.match(
new RegExp(
`your Overleaf account on ${notificationsInstitution.email} ` +
`has been linked to your ${notificationsInstitution.institutionName} ` +
`account.`,
'i'
)
)
const closeBtn = screen.getByRole('button', { name: /close/i })
fireEvent.click(closeBtn)