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

safe-global / safe-client-gateway / 16448034107

22 Jul 2025 01:21PM UTC coverage: 89.594%. First build
16448034107

Pull #2627

github

LucieFaire
Add tests from TransactionExport entity

Signed-off-by: dsh <11198975+LucieFaire@users.noreply.github.com>
Pull Request #2627: feat: add datasource for export api

3466 of 4239 branches covered (81.76%)

Branch coverage included in aggregate %.

48 of 64 new or added lines in 7 files covered. (75.0%)

12058 of 13088 relevant lines covered (92.13%)

543.94 hits per line

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

86.21
/src/modules/csv-export/v1/datasources/export-api.manager.ts
1
import { Inject, Injectable } from '@nestjs/common';
2✔
2
import { IConfigurationService } from '@/config/configuration.service.interface';
2✔
3
import { CacheFirstDataSource } from '@/datasources/cache/cache.first.data.source';
2✔
4
import { HttpErrorFactory } from '@/datasources/errors/http-error-factory';
2✔
5
import { ChainSchema } from '@/domain/chains/entities/schemas/chain.schema';
2✔
6
import { IConfigApi } from '@/domain/interfaces/config-api.interface';
2✔
7
import type { IExportApi } from './export-api.interface';
8
import { ExportApi } from './export-api.service';
2✔
9
import { IExportApiManager } from '@/modules/csv-export/v1/datasources/export-api.manager.interface';
10

11
@Injectable()
12
export class ExportApiManager implements IExportApiManager {
2✔
13
  private readonly exportApiMap: Record<string, ExportApi> = {};
6✔
14
  private readonly useVpcUrl: boolean;
15

16
  constructor(
17
    @Inject(IConfigurationService)
18
    private readonly configurationService: IConfigurationService,
6✔
19
    @Inject(IConfigApi) private readonly configApi: IConfigApi,
6✔
20
    private readonly dataSource: CacheFirstDataSource,
6✔
21
    private readonly httpErrorFactory: HttpErrorFactory,
6✔
22
  ) {
23
    this.useVpcUrl = this.configurationService.getOrThrow<boolean>(
6✔
24
      'safeTransaction.useVpcUrl',
25
    );
26
  }
27

28
  async getApi(chainId: string): Promise<IExportApi> {
29
    const api = this.exportApiMap[chainId];
8✔
30
    if (api) return api;
8✔
31

32
    const chain = await this.configApi
6✔
33
      .getChain(chainId)
34
      .then(ChainSchema.parse);
35
    const baseUrl = this.useVpcUrl
6✔
36
      ? chain.vpcTransactionService
37
      : chain.transactionService;
38
    this.exportApiMap[chainId] = new ExportApi(
6✔
39
      chainId,
40
      baseUrl,
41
      this.dataSource,
42
      this.configurationService,
43
      this.httpErrorFactory,
44
    );
45
    return this.exportApiMap[chainId];
6✔
46
  }
47

48
  destroyApi(chainId: string): void {
NEW
49
    if (this.exportApiMap[chainId]) {
×
NEW
50
      delete this.exportApiMap[chainId];
×
51
    }
52
  }
53
}
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