mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #31736 from overleaf/jel-find-group-only-if-domain-confirmed
[web] Only query group with domain capture if domain is confirmed GitOrigin-RevId: 612a711730b1f090f3e47410fd4ad68df33eca93
This commit is contained in:
@@ -148,6 +148,7 @@ describe('InstitutionsAPI', function () {
|
||||
foo: 'bar',
|
||||
institution: {
|
||||
commonsAccount: true,
|
||||
confirmed: true,
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -173,6 +174,7 @@ describe('InstitutionsAPI', function () {
|
||||
foo: 'bar',
|
||||
institution: {
|
||||
commonsAccount: false,
|
||||
confirmed: true,
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -212,6 +214,37 @@ describe('InstitutionsAPI', function () {
|
||||
])
|
||||
})
|
||||
|
||||
it('does not query for group with domain capture if domain is not confirmed', async function (ctx) {
|
||||
const responseBody = [
|
||||
{
|
||||
id: '123abc',
|
||||
foo: 'bar',
|
||||
institution: {
|
||||
commonsAccount: false,
|
||||
confirmed: false,
|
||||
},
|
||||
},
|
||||
]
|
||||
ctx.request.callsArgWith(1, null, { statusCode: 201 }, responseBody)
|
||||
|
||||
const body = await ctx.InstitutionsAPI.promises.getUserAffiliations(
|
||||
ctx.stubbedUser._id
|
||||
)
|
||||
ctx.request.calledOnce.should.equal(true)
|
||||
const requestOptions = ctx.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/users/${ctx.stubbedUser._id}/affiliations`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('GET')
|
||||
requestOptions.maxAttempts.should.equal(3)
|
||||
ctx.Modules.promises.hooks.fire.should.not.have.been.called
|
||||
expect(requestOptions.body).not.to.exist
|
||||
expect(body).to.deep.equal([
|
||||
{
|
||||
...responseBody[0],
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it('handle error', async function (ctx) {
|
||||
const body = { errors: 'affiliation error message' }
|
||||
ctx.request.callsArgWith(1, null, { statusCode: 503 }, body)
|
||||
|
||||
Reference in New Issue
Block a user