hunk.code_window:         environmentId: session.environment._id,
           channelType: ChannelTypeEnum.SMS,
         })
       );
       expect(result).to.have.length(0);
     });
     it('should not return Novu integration if there is active integrations', async function () {
       sinon.stub(integrationRepository, 'count').resolves(1);
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep
hunk.after_edit:     expect(result).to.equal(undefined);
  
hunk.file_path: apps/api/src/app/integrations/usecases/get-novu-integration/get-novu-integration.spec.ts
hunk.type: replace
file: import { Injectable } from '@nestjs/common';
  import { IntegrationEntity, IntegrationRepository } from '@novu/dal';
  import { GetDecryptedIntegrationsCommand } from './get-decrypted-integrations.command';
  import { decryptCredentials } from '../../../shared/services/encryption';
  import { GetNovuIntegration } from '../get-novu-integration';
  import { GetNovuIntegrationCommand } from '../get-novu-integration/get-novu-integration.command';
  
  @Injectable()
  export class GetDecryptedIntegrations {
    constructor(private integrationRepository: IntegrationRepository, private getNovuIntegration: GetNovuIntegration) {}
  
    async execute(command: GetDecryptedIntegrationsCommand): Promise<IntegrationEntity[]> {
      const query: Partial<IntegrationEntity> & { _environmentId: string } = {
        _environmentId: command.environmentId,
      };
  
      if (command.active) {
        query.active = command.active;
      }
  
      if (command.channelType) {
        query.channel = command.channelType;
      }
  
      if (command.providerId) {
        query.providerId = command.providerId;
      }
  
      let integrations = command.findOne
        ? [await this.integrationRepository.findOne(query)]
        : await this.integrationRepository.find(query);
  
      integrations = integrations
        .filter((integration) => integration)
        .map((integration: IntegrationEntity) => {
          integration.credentials = decryptCredentials(integration.credentials);
  
          return integration;
        });
  
      if (command.channelType === undefined) {
        return integrations;
      }
  
      const novuIntegrations = await this.getNovuIntegration.execute(
        GetNovuIntegrationCommand.create({
          channelType: command.channelType,
          organizationId: command.organizationId,
          environmentId: command.environmentId,
        })
      );
  
      return novuIntegrations.length > 0 ? novuIntegrations : integrations;
    }
  }
  