|
|
@@ -117,5 +117,45 @@ describe('<EmailsRow/>', function () {
|
|
|
.null
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+ describe('and domain capture is also on for group and Commons SSO also enabled', function () {
|
|
|
+ // scenario of a Commons account migrating to a group account
|
|
|
+ let affiliatedEmailWithDomainCaptureAndCommons: UserEmailData & {
|
|
|
+ affiliation: Affiliation
|
|
|
+ }
|
|
|
+ beforeEach(async function () {
|
|
|
+ fetchMock.removeRoutes().clearHistory()
|
|
|
+
|
|
|
+ affiliatedEmailWithDomainCaptureAndCommons = cloneDeep(affiliatedEmail)
|
|
|
+ affiliatedEmailWithDomainCaptureAndCommons.affiliation.group = {
|
|
|
+ _id: 'grou123',
|
|
|
+ domainCaptureEnabled: true,
|
|
|
+ managedUsersEnabled: true,
|
|
|
+ }
|
|
|
+
|
|
|
+ await fetchMock.callHistory.flush(true)
|
|
|
+ })
|
|
|
+
|
|
|
+ it('does not prompt the user to link to their institutional account', function () {
|
|
|
+ renderEmailsRow(affiliatedEmailWithDomainCaptureAndCommons)
|
|
|
+ expect(() =>
|
|
|
+ getByTextContent(
|
|
|
+ 'You can now link your Overleaf account to your Overleaf institutional account.'
|
|
|
+ )
|
|
|
+ ).to.throw('Unable to find an element with the text')
|
|
|
+ expect(screen.queryByRole('button', { name: 'Link accounts' })).to.be
|
|
|
+ .null
|
|
|
+ })
|
|
|
+
|
|
|
+ it('still shows users can log in via Commons SSO if already linked', function () {
|
|
|
+ affiliatedEmailWithDomainCaptureAndCommons.samlProviderId = '1'
|
|
|
+ renderEmailsRow(affiliatedEmailWithDomainCaptureAndCommons)
|
|
|
+ getByTextContent(
|
|
|
+ 'You can log in to Overleaf through your Overleaf institutional login.'
|
|
|
+ )
|
|
|
+ expect(screen.queryByRole('button', { name: 'Link accounts' })).to.be
|
|
|
+ .null
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
})
|