1be43911b4
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
66 lines
1.9 KiB
JavaScript
66 lines
1.9 KiB
JavaScript
const { expect } = require('chai')
|
|
const path = require('path')
|
|
const InstitutionsHelper = require(path.join(
|
|
__dirname,
|
|
'/../../../../app/src/Features/Institutions/InstitutionsHelper'
|
|
))
|
|
|
|
describe('InstitutionsHelper', function () {
|
|
describe('emailHasLicence', function () {
|
|
it('returns licence', function () {
|
|
const emailHasLicence = InstitutionsHelper.emailHasLicence({
|
|
confirmedAt: new Date(),
|
|
affiliation: {
|
|
institution: { confirmed: true },
|
|
licence: 'pro_plus',
|
|
},
|
|
})
|
|
expect(emailHasLicence).to.be.true
|
|
})
|
|
|
|
it('returns false if licence is free', function () {
|
|
const emailHasLicence = InstitutionsHelper.emailHasLicence({
|
|
confirmedAt: new Date(),
|
|
affiliation: {
|
|
institution: { confirmed: true },
|
|
licence: 'free',
|
|
},
|
|
})
|
|
expect(emailHasLicence).to.be.false
|
|
})
|
|
|
|
it('returns false if licence is null', function () {
|
|
const emailHasLicence = InstitutionsHelper.emailHasLicence({
|
|
confirmedAt: new Date(),
|
|
affiliation: {
|
|
institution: { confirmed: true },
|
|
licence: null,
|
|
},
|
|
})
|
|
expect(emailHasLicence).to.be.false
|
|
})
|
|
|
|
it('returns false if institution is not confirmed', function () {
|
|
const emailHasLicence = InstitutionsHelper.emailHasLicence({
|
|
confirmedAt: new Date(),
|
|
affiliation: {
|
|
institution: { confirmed: false },
|
|
licence: 'pro_plus',
|
|
},
|
|
})
|
|
expect(emailHasLicence).to.be.false
|
|
})
|
|
|
|
it('returns false if email is not confirmed', function () {
|
|
const emailHasLicence = InstitutionsHelper.emailHasLicence({
|
|
confirmedAt: null,
|
|
affiliation: {
|
|
institution: { confirmed: true },
|
|
licence: 'pro_plus',
|
|
},
|
|
})
|
|
expect(emailHasLicence).to.be.false
|
|
})
|
|
})
|
|
})
|