Merge pull request #23890 from overleaf/jel-reconfirm-date

[web] If v1 date doesn't show as reconfirmed, ensure v2 does not as well

GitOrigin-RevId: dc2850221a2d9176023380b38508311ea98abe43
This commit is contained in:
Jessica Lawshe
2025-02-27 09:05:27 +00:00
committed by Copybot
parent fc19e1d34a
commit 182713d02d
2 changed files with 64 additions and 3 deletions
@@ -946,6 +946,50 @@ describe('UserGetter', function () {
)
})
it('should flag to show notification if v2 shows as reconfirmation upcoming but v1 does not', function (done) {
const email = 'abc123@test.com'
const { maxConfirmationMonths } = institutionNonSSO
const datePastReconfirmation = moment()
.subtract(maxConfirmationMonths, 'months')
.add(3, 'day')
.toDate()
const dateNotPastReconfirmation = moment().add(1, 'month').toDate()
const affiliationsData = [
{
email,
licence: 'free',
institution: institutionNonSSO,
last_day_to_reconfirm: dateNotPastReconfirmation,
},
]
const user = {
_id: '12390i',
email,
emails: [
{
email,
confirmedAt: datePastReconfirmation,
default: true,
},
],
}
this.getUserAffiliations.resolves(affiliationsData)
this.UserGetter.promises.getUser = sinon.stub().resolves(user)
this.UserGetter.getUserFullEmails(
this.fakeUser._id,
(error, fullEmails) => {
expect(error).to.not.exist
expect(
fullEmails[0].affiliation.inReconfirmNotificationPeriod
).to.equal(true)
done()
}
)
})
describe('cachedLastDayToReconfirm', function () {
const email = 'abc123@test.com'
const confirmedAt = new Date('2019-07-11T18:25:01.639Z')