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

safe-global / safe-client-gateway / 21747150924

06 Feb 2026 10:23AM UTC coverage: 87.207% (-2.2%) from 89.395%
21747150924

Pull #2909

github

PooyaRaki
fix: fix lint errors
Pull Request #2909: Release 1.100.0

1016 of 1303 branches covered (77.97%)

Branch coverage included in aggregate %.

137 of 167 new or added lines in 15 files covered. (82.04%)

252 existing lines in 34 files now uncovered.

4519 of 5044 relevant lines covered (89.59%)

1788.12 hits per line

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

88.24
/src/__tests__/testing-module.ts
1
import { Test, type TestingModule } from '@nestjs/testing';
94✔
2
import { AppModule } from '@/app.module';
94✔
3
import configuration from '@/config/entities/__tests__/configuration';
94✔
4
import { CacheModule } from '@/datasources/cache/cache.module';
94✔
5
import { TestCacheModule } from '@/datasources/cache/__tests__/test.cache.module';
94✔
6
import { RequestScopedLoggingModule } from '@/logging/logging.module';
94✔
7
import { TestLoggingModule } from '@/logging/__tests__/test.logging.module';
94✔
8
import { NetworkModule } from '@/datasources/network/network.module';
94✔
9
import { TestNetworkModule } from '@/datasources/network/__tests__/test.network.module';
94✔
10
import { QueuesApiModule } from '@/modules/queues/datasources/queues-api.module';
94✔
11
import { TestQueuesApiModule } from '@/modules/queues/datasources/__tests__/test.queues-api.module';
94✔
12
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
94✔
13
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
94✔
14
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
94✔
15
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
94✔
16
import { TargetedMessagingDatasourceModule } from '@/modules/targeted-messaging/datasources/targeted-messaging.datasource.module';
94✔
17
import { TestTargetedMessagingDatasourceModule } from '@/modules/targeted-messaging/datasources/__tests__/test.targeted-messaging.datasource.module';
94✔
18
import type { ModuleDefinition } from '@nestjs/core/interfaces/module-definition.interface';
19
import { CacheKeyPrefix } from '@/datasources/cache/constants';
94✔
20
import type { Provider } from '@nestjs/common';
21
import { CsvExportModule } from '@/modules/csv-export/csv-export.module';
94✔
22
import { TestCsvExportModule } from '@/modules/csv-export/v1/__tests__/test.csv-export.module';
94✔
23
import { TxAuthNetworkModule } from '@/datasources/network/tx-auth.network.module';
94✔
24
import { TestTxAuthNetworkModule } from '@/datasources/network/__tests__/test.tx-auth.network.module';
94✔
25
import type { Address } from 'viem';
26
import { IBlocklistService } from '@/config/entities/blocklist.interface';
94✔
27

28
// Create a mock blocklist service for tests
29
const testBlocklistService: IBlocklistService = {
94✔
30
  getBlocklist(): Array<Address> {
NEW
31
    return [];
×
32
  },
33
  clearCache(): void {
34
    // No-op in tests
35
  },
36
};
37

38
export interface CreateBaseTestModuleOptions {
39
  config?: typeof configuration;
40
  overridePostgresV2?: boolean;
41
  cacheKeyPrefix?: string;
42
  modules?: Array<ModuleOverride>;
43
  providers?: Array<Provider>;
44
  guards?: Array<GuardOverride>;
45
}
46

47
export interface ModuleOverride {
48
  originalModule: ModuleDefinition;
49
  testModule: ModuleDefinition;
50
}
51

52
export interface GuardOverride {
53
  originalGuard: unknown;
54
  testGuard: unknown;
55
}
56

57
export async function createTestModule(
94✔
58
  options: CreateBaseTestModuleOptions = {},
116✔
59
): Promise<TestingModule> {
60
  const {
61
    config,
62
    cacheKeyPrefix,
63
    overridePostgresV2,
64
    modules: additionalOverrides = [],
703✔
65
    guards: guards = [],
959✔
66
    providers = [],
864✔
67
  } = options;
1,918✔
68

69
  return createBaseTestModule({
1,918✔
70
    config,
71
    overridePostgresV2,
72
    cacheKeyPrefix,
73
    guards,
74
    providers,
75
    modules: [
76
      {
77
        originalModule: CacheModule,
78
        testModule: TestCacheModule,
79
      },
80
      {
81
        originalModule: RequestScopedLoggingModule,
82
        testModule: TestLoggingModule,
83
      },
84
      {
85
        originalModule: NetworkModule,
86
        testModule: TestNetworkModule,
87
      },
88
      {
89
        originalModule: TxAuthNetworkModule,
90
        testModule: TestTxAuthNetworkModule,
91
      },
92
      ...additionalOverrides,
93
    ],
94
  });
95
}
96

97
export async function createBaseTestModule(
94✔
98
  options: CreateBaseTestModuleOptions = {},
×
99
): Promise<TestingModule> {
100
  const {
101
    config = configuration,
138✔
102
    overridePostgresV2 = true, // Enable Postgres V2 by default
959✔
103
    cacheKeyPrefix = crypto.randomUUID(),
959✔
104
    modules: additionalOverrides = [],
×
105
    guards: guards = [],
×
106
    providers = [],
×
107
  } = options;
1,918✔
108

109
  const moduleBuilder = Test.createTestingModule({
1,918✔
110
    imports: [AppModule.register(config)],
111
    providers: providers,
112
  })
113
    .overrideProvider(CacheKeyPrefix)
114
    .useValue(cacheKeyPrefix)
115
    .overrideProvider(IBlocklistService)
116
    .useValue(testBlocklistService)
117
    .overrideModule(PostgresDatabaseModule)
118
    .useModule(TestPostgresDatabaseModule)
119
    .overrideModule(TargetedMessagingDatasourceModule)
120
    .useModule(TestTargetedMessagingDatasourceModule)
121
    .overrideModule(QueuesApiModule)
122
    .useModule(TestQueuesApiModule)
123
    .overrideModule(CsvExportModule)
124
    .useModule(TestCsvExportModule);
125

126
  if (overridePostgresV2) {
1,918✔
127
    moduleBuilder
1,918✔
128
      .overrideModule(PostgresDatabaseModuleV2)
129
      .useModule(TestPostgresDatabaseModuleV2);
130
  }
131

132
  for (const guard of guards) {
1,918✔
133
    moduleBuilder.overrideGuard(guard.originalGuard).useValue(guard.testGuard);
×
134
  }
135

136
  // Apply additional overrides
137
  for (const override of additionalOverrides) {
1,918✔
138
    moduleBuilder
8,912✔
139
      .overrideModule(override.originalModule)
140
      .useModule(override.testModule);
141
  }
142

143
  return moduleBuilder.compile();
1,918✔
144
}
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