diff --git a/services/web/app/src/Features/User/SAMLIdentityManager.js b/services/web/app/src/Features/User/SAMLIdentityManager.js index 543e2b9748..1fc2891cb4 100644 --- a/services/web/app/src/Features/User/SAMLIdentityManager.js +++ b/services/web/app/src/Features/User/SAMLIdentityManager.js @@ -226,7 +226,7 @@ async function redundantSubscription(userId, providerId, providerName) { const subscription = await SubscriptionLocator.promises.getUserIndividualSubscription(userId) - if (subscription) { + if (subscription && !subscription.groupPlan) { await NotificationsBuilder.promises .redundantPersonalSubscription( { diff --git a/services/web/test/unit/src/User/SAMLIdentityManagerTests.js b/services/web/test/unit/src/User/SAMLIdentityManagerTests.js index a3f6d05baf..a24f48771d 100644 --- a/services/web/test/unit/src/User/SAMLIdentityManagerTests.js +++ b/services/web/test/unit/src/User/SAMLIdentityManagerTests.js @@ -536,6 +536,7 @@ describe('SAMLIdentityManager', function () { const userId = '1bv' const providerId = 123 const providerName = 'University Name' + describe('with a personal subscription', function () { beforeEach(function () { this.SubscriptionLocator.promises.getUserIndividualSubscription.resolves( @@ -544,6 +545,7 @@ describe('SAMLIdentityManager', function () { } ) }) + it('should create redundant personal subscription notification ', async function () { try { await this.SAMLIdentityManager.redundantSubscription( @@ -558,7 +560,17 @@ describe('SAMLIdentityManager', function () { .to.have.been.calledOnce }) }) - describe('without a personal subscription', function () { + + describe('with a group subscription', function () { + beforeEach(function () { + this.SubscriptionLocator.promises.getUserIndividualSubscription.resolves( + { + planCode: 'professional', + groupPlan: true, + } + ) + }) + it('should create redundant personal subscription notification ', async function () { try { await this.SAMLIdentityManager.redundantSubscription( @@ -573,5 +585,21 @@ describe('SAMLIdentityManager', function () { .to.not.have.been.called }) }) + + describe('without a personal subscription', function () { + it('should not create redundant personal subscription notification ', async function () { + try { + await this.SAMLIdentityManager.redundantSubscription( + userId, + providerId, + providerName + ) + } catch (error) { + expect(error).to.not.exist + } + expect(this.NotificationsBuilder.promises.redundantPersonalSubscription) + .to.not.have.been.called + }) + }) }) })