All files / src/modules/search search.module.ts

100% Statements 11/11
50% Branches 4/8
100% Functions 0/0
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  11x 11x 11x 11x 11x 11x 11x 11x                                       11x
// src/modules/search/search.module.ts
import { Module } from '@nestjs/common';
import { SearchService } from '@app/modules/search/search.service';
import { SearchController } from '@app/modules/search/search.controller';
import { SearchResolver } from '@app/modules/search/search.resolver';
import { ElasticsearchModule } from '@app/modules/search/elasticsearch.module';
import { PrismaModule } from '@app/modules/prisma/prisma.module';
import { BullModule } from '@nestjs/bullmq';
import { ListingIndexProcessor } from '@app/modules/search/listing-index.processor';
 
@Module({
  imports: [
    PrismaModule,
    // Always import ElasticsearchModule; it provides a test-safe client when in tests
    ElasticsearchModule,
    // Gate Bull queue registration in tests; provide NullQueue at app level
    ...(!(process.env.NODE_ENV === 'test' || process.env.TEST_MODE === '1')
      ? [BullModule.registerQueue({ name: 'listingIndex' })]
      : []),
  ],
  providers: [
    SearchService,
    SearchResolver,
    ...(!(process.env.NODE_ENV === 'test' || process.env.TEST_MODE === '1') ? [ListingIndexProcessor] : []),
  ],
controllers: [SearchController],
  exports: [SearchService],
})
export class SearchModule {}