• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-client-gateway / 18004330328

25 Sep 2025 10:16AM UTC coverage: 87.972% (-1.2%) from 89.219%
18004330328

Pull #2712

github

LucieFaire
extract complex logic to separate func

Signed-off-by: dsh <11198975+LucieFaire@users.noreply.github.com>
Pull Request #2712: feat: Contract verification analysis

3623 of 4594 branches covered (78.86%)

Branch coverage included in aggregate %.

99 of 235 new or added lines in 22 files covered. (42.13%)

57 existing lines in 9 files now uncovered.

12504 of 13738 relevant lines covered (91.02%)

525.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
/src/modules/csv-export/v1/consumers/csv-export.consumer.ts
1
import { CSV_EXPORT_QUEUE } from '@/domain/common/entities/jobs.constants';
104✔
2
import { LogType } from '@/domain/common/entities/log-type.entity';
104✔
3
import { ILoggingService, LoggingService } from '@/logging/logging.interface';
104✔
4
import { CsvExportService } from '@/modules/csv-export/v1/csv-export.service';
104✔
5
import {
6
  CsvExportJobData,
7
  CsvExportJobResponse,
8
} from '@/modules/csv-export/v1/entities/csv-export-job-data.entity';
9
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq';
104✔
10
import { Inject } from '@nestjs/common';
104✔
11
import { Job } from 'bullmq';
104✔
12

13
@Processor(CSV_EXPORT_QUEUE)
14
export class CsvExportConsumer extends WorkerHost {
104✔
15
  constructor(
16
    @Inject(LoggingService) private readonly loggingService: ILoggingService,
4✔
17
    private readonly csvExportService: CsvExportService,
4✔
18
  ) {
19
    super();
4✔
20
  }
21

22
  async process(
23
    job: Job<CsvExportJobData, CsvExportJobResponse>,
24
  ): Promise<CsvExportJobResponse> {
UNCOV
25
    this.loggingService.info({
×
26
      type: LogType.JobEvent,
27
      source: 'CsvExportConsumer',
28
      event: `Processing job ${job.id}`,
29
      attemptsMade: job.attemptsMade,
30
    });
31

UNCOV
32
    const { timestamp } = job;
×
33
    const {
34
      chainId,
35
      safeAddress,
36
      executionDateGte,
37
      executionDateLte,
38
      limit,
39
      offset,
UNCOV
40
    } = job.data;
×
41

UNCOV
42
    const signedUrl = await this.csvExportService.export(
×
43
      {
44
        chainId,
45
        safeAddress,
46
        timestamp,
47
        executionDateGte,
48
        executionDateLte,
49
        limit,
50
        offset,
51
      },
52
      async (progress: number) => {
UNCOV
53
        await job.updateProgress(progress);
×
54
      },
55
    );
56

UNCOV
57
    return { downloadUrl: signedUrl };
×
58
  }
59

60
  @OnWorkerEvent('completed')
61
  onCompleted(job: Job): void {
104✔
UNCOV
62
    this.loggingService.info({
×
63
      type: LogType.JobEvent,
64
      source: 'CsvExportConsumer',
65
      event: `Job ${job.id} completed`,
66
    });
67
  }
68

69
  // Fired when a job fails after all retries
70
  @OnWorkerEvent('failed')
71
  onFailed(job: Job, error: Error): void {
104✔
UNCOV
72
    this.loggingService.error({
×
73
      type: LogType.JobError,
74
      source: 'CsvExportConsumer',
75
      event: `Job ${job.id} failed. ${error}`,
76
    });
77
  }
78

79
  @OnWorkerEvent('progress')
80
  onProgress(job: Job, progress: number): void {
104✔
UNCOV
81
    this.loggingService.info({
×
82
      type: LogType.JobEvent,
83
      source: 'CsvExportConsumer',
84
      event: `Job ${job.id} progress: ${progress}%`,
85
    });
86
  }
87

88
  @OnWorkerEvent('error')
89
  onWorkerError(error: Error): void {
104✔
UNCOV
90
    this.loggingService.error({
×
91
      type: LogType.JobError,
92
      source: 'CsvExportConsumer',
93
      event: `Worker encountered an error: ${error}`,
94
    });
95
  }
96
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc