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

safe-global / safe-client-gateway / 9994570607

18 Jul 2024 03:43PM UTC coverage: 48.141% (-0.04%) from 48.182%
9994570607

push

github

web-flow
Add tests for `FirebaseCloudMessagingApiService` (#1769)

Add according test coverage for `FirebaseCloudMessagingApiService`.

417 of 2612 branches covered (15.96%)

Branch coverage included in aggregate %.

4282 of 7149 relevant lines covered (59.9%)

13.0 hits per line

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

90.32
/src/datasources/transaction-api/transaction-api.manager.ts
1
import { Inject, Injectable } from '@nestjs/common';
16✔
2
import { IConfigurationService } from '@/config/configuration.service.interface';
16✔
3
import { CacheFirstDataSource } from '@/datasources/cache/cache.first.data.source';
16✔
4
import {
16✔
5
  CacheService,
6
  ICacheService,
7
} from '@/datasources/cache/cache.service.interface';
8
import { HttpErrorFactory } from '@/datasources/errors/http-error-factory';
16✔
9
import {
16✔
10
  INetworkService,
11
  NetworkService,
12
} from '@/datasources/network/network.service.interface';
13
import { TransactionApi } from '@/datasources/transaction-api/transaction-api.service';
16✔
14
import { Chain } from '@/domain/chains/entities/chain.entity';
15
import { IConfigApi } from '@/domain/interfaces/config-api.interface';
16✔
16
import { ITransactionApiManager } from '@/domain/interfaces/transaction-api.manager.interface';
17
import { ILoggingService, LoggingService } from '@/logging/logging.interface';
16✔
18

19
@Injectable()
20
export class TransactionApiManager implements ITransactionApiManager {
16✔
21
  private transactionApiMap: Record<string, TransactionApi> = {};
16✔
22

23
  private readonly useVpcUrl: boolean;
24

25
  constructor(
26
    @Inject(IConfigurationService)
27
    private readonly configurationService: IConfigurationService,
16✔
28
    @Inject(IConfigApi) private readonly configApi: IConfigApi,
16✔
29
    private readonly dataSource: CacheFirstDataSource,
16✔
30
    @Inject(CacheService) private readonly cacheService: ICacheService,
16✔
31
    private readonly httpErrorFactory: HttpErrorFactory,
16✔
32
    @Inject(NetworkService) private readonly networkService: INetworkService,
16✔
33
    @Inject(LoggingService) private readonly loggingService: ILoggingService,
16✔
34
  ) {
35
    this.useVpcUrl = this.configurationService.getOrThrow<boolean>(
16✔
36
      'safeTransaction.useVpcUrl',
37
    );
38
  }
39

40
  async getApi(chainId: string): Promise<TransactionApi> {
41
    const transactionApi = this.transactionApiMap[chainId];
272✔
42
    if (transactionApi !== undefined) return transactionApi;
272✔
43

44
    const chain: Chain = await this.configApi.getChain(chainId);
18✔
45
    this.transactionApiMap[chainId] = new TransactionApi(
18✔
46
      chainId,
47
      this.useVpcUrl ? chain.vpcTransactionService : chain.transactionService,
9!
48
      this.dataSource,
49
      this.cacheService,
50
      this.configurationService,
51
      this.httpErrorFactory,
52
      this.networkService,
53
      this.loggingService,
54
    );
55
    return this.transactionApiMap[chainId];
18✔
56
  }
57

58
  destroyApi(chainId: string): void {
59
    if (this.transactionApiMap[chainId] !== undefined) {
2!
60
      delete this.transactionApiMap[chainId];
×
61
    }
62
  }
63
}
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