@@ -2,12 +2,7 @@ import sinon from 'sinon';
2
2
import { expect } from 'chai' ;
3
3
import { NotFoundException , BadRequestException } from '@nestjs/common' ;
4
4
import { CommunityOrganizationRepository , EnvironmentRepository , IntegrationRepository } from '@novu/dal' ;
5
- import {
6
- AnalyticsService ,
7
- CreateOrUpdateSubscriberUseCase ,
8
- FeatureFlagsService ,
9
- SelectIntegration ,
10
- } from '@novu/application-generic' ;
5
+ import { AnalyticsService , CreateOrUpdateSubscriberUseCase , SelectIntegration } from '@novu/application-generic' ;
11
6
import { ApiServiceLevelEnum , ChannelTypeEnum , InAppProviderIdEnum } from '@novu/shared' ;
12
7
import { AuthService } from '../../../auth/services/auth.service' ;
13
8
import { Session } from './session.usecase' ;
@@ -45,7 +40,6 @@ describe('Session', () => {
45
40
let notificationsCount : sinon . SinonStubbedInstance < NotificationsCount > ;
46
41
let integrationRepository : sinon . SinonStubbedInstance < IntegrationRepository > ;
47
42
let organizationRepository : sinon . SinonStubbedInstance < CommunityOrganizationRepository > ;
48
- let featureFlagsService : sinon . SinonStubbedInstance < FeatureFlagsService > ;
49
43
50
44
beforeEach ( ( ) => {
51
45
environmentRepository = sinon . createStubInstance ( EnvironmentRepository ) ;
@@ -56,7 +50,6 @@ describe('Session', () => {
56
50
notificationsCount = sinon . createStubInstance ( NotificationsCount ) ;
57
51
integrationRepository = sinon . createStubInstance ( IntegrationRepository ) ;
58
52
organizationRepository = sinon . createStubInstance ( CommunityOrganizationRepository ) ;
59
- featureFlagsService = sinon . createStubInstance ( FeatureFlagsService ) ;
60
53
61
54
session = new Session (
62
55
environmentRepository as any ,
@@ -66,8 +59,7 @@ describe('Session', () => {
66
59
analyticsService as any ,
67
60
notificationsCount as any ,
68
61
integrationRepository as any ,
69
- organizationRepository as any ,
70
- featureFlagsService as any
62
+ organizationRepository as any
71
63
) ;
72
64
} ) ;
73
65
@@ -226,9 +218,7 @@ describe('Session', () => {
226
218
) . to . be . true ;
227
219
} ) ;
228
220
229
- it ( 'should return the correct isSnoozeEnabled value for different service levels' , async ( ) => {
230
- featureFlagsService . getFlag . resolves ( true ) ;
231
-
221
+ it ( 'should return the correct maxSnoozeDurationHours value for different service levels' , async ( ) => {
232
222
const command : SessionCommand = {
233
223
applicationIdentifier : 'app-id' ,
234
224
subscriber : { subscriberId : 'subscriber-id' } ,
@@ -247,24 +237,24 @@ describe('Session', () => {
247
237
notificationsCount . execute . resolves ( notificationCount ) ;
248
238
authService . getSubscriberWidgetToken . resolves ( token ) ;
249
239
250
- // FREE plan should have snooze disabled
240
+ // FREE plan should have 24 hours max snooze duration
251
241
organizationRepository . findOne . resolves ( { apiServiceLevel : ApiServiceLevelEnum . FREE } as any ) ;
252
242
const freeResponse : SubscriberSessionResponseDto = await session . execute ( command ) ;
253
- expect ( freeResponse . isSnoozeEnabled ) . to . equal ( false ) ;
243
+ expect ( freeResponse . maxSnoozeDurationHours ) . to . equal ( 24 ) ;
254
244
255
- // PRO plan should have snooze enabled
245
+ // PRO plan should have 90 days max snooze duration
256
246
organizationRepository . findOne . resolves ( { apiServiceLevel : ApiServiceLevelEnum . PRO } as any ) ;
257
247
const proResponse : SubscriberSessionResponseDto = await session . execute ( command ) ;
258
- expect ( proResponse . isSnoozeEnabled ) . to . equal ( true ) ;
248
+ expect ( proResponse . maxSnoozeDurationHours ) . to . equal ( 90 * 24 ) ;
259
249
260
- // BUSINESS/TEAM plan should have snooze enabled
250
+ // BUSINESS/TEAM plan should have 90 days max snooze duration
261
251
organizationRepository . findOne . resolves ( { apiServiceLevel : ApiServiceLevelEnum . BUSINESS } as any ) ;
262
252
const businessResponse : SubscriberSessionResponseDto = await session . execute ( command ) ;
263
- expect ( businessResponse . isSnoozeEnabled ) . to . equal ( true ) ;
253
+ expect ( businessResponse . maxSnoozeDurationHours ) . to . equal ( 90 * 24 ) ;
264
254
265
- // ENTERPRISE plan should have snooze enabled
255
+ // ENTERPRISE plan should have 90 days max snooze duration
266
256
organizationRepository . findOne . resolves ( { apiServiceLevel : ApiServiceLevelEnum . ENTERPRISE } as any ) ;
267
257
const enterpriseResponse : SubscriberSessionResponseDto = await session . execute ( command ) ;
268
- expect ( enterpriseResponse . isSnoozeEnabled ) . to . equal ( true ) ;
258
+ expect ( enterpriseResponse . maxSnoozeDurationHours ) . to . equal ( 90 * 24 ) ;
269
259
} ) ;
270
260
} ) ;
0 commit comments