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

safe-global / safe-client-gateway-nest / 5950252681

23 Aug 2023 10:39AM UTC coverage: 92.588% (+0.1%) from 92.463%
5950252681

Pull #654

github

hectorgomezv
Add caching for getMessageByhash
Pull Request #654: Manage caching for messages

934 of 1109 branches covered (84.22%)

Branch coverage included in aggregate %.

28 of 29 new or added lines in 9 files covered. (96.55%)

11 existing lines in 1 file now uncovered.

4400 of 4652 relevant lines covered (94.58%)

71.07 hits per line

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

0.0
/src/routes/contracts/__tests__/get-contract.e2e-spec.ts
1
import * as request from 'supertest';
×
2
import { RedisClientType } from 'redis';
3
import { INestApplication } from '@nestjs/common';
4
import { Test } from '@nestjs/testing';
×
5
import { AppModule } from '../../../app.module';
×
6
import { redisClientFactory } from '../../../__tests__/redis-client.factory';
×
7
import { TestAppProvider } from '../../../__tests__/test-app.provider';
×
8

9
describe('Get contract e2e test', () => {
×
10
  let app: INestApplication;
11
  let redisClient: RedisClientType;
12
  const chainId = '5'; // Görli testnet
×
13

14
  beforeAll(async () => {
×
15
    const moduleRef = await Test.createTestingModule({
×
16
      imports: [AppModule],
17
    }).compile();
18

19
    app = await new TestAppProvider().provide(moduleRef);
×
20
    await app.init();
×
21
    redisClient = await redisClientFactory();
×
22
  });
23

24
  beforeEach(async () => {
×
25
    await redisClient.flushAll();
×
26
  });
27

28
  it('GET /contracts/<address>', async () => {
×
29
    const contractAddress = '0x7cbB62EaA69F79e6873cD1ecB2392971036cFAa4';
×
30
    const expectedResponse = {
×
31
      address: '0x7cbB62EaA69F79e6873cD1ecB2392971036cFAa4',
32
      name: 'CreateCall',
33
      displayName: '',
34
      logoUri: null,
35
      contractAbi: {
36
        abi: [
37
          {
38
            name: 'ContractCreation',
39
            type: 'event',
40
            inputs: [
41
              {
42
                name: 'newContract',
43
                type: 'address',
44
                indexed: false,
45
                internalType: 'address',
46
              },
47
            ],
48
            anonymous: false,
49
          },
50
          {
51
            name: 'performCreate',
52
            type: 'function',
53
            inputs: [
54
              {
55
                name: 'value',
56
                type: 'uint256',
57
                internalType: 'uint256',
58
              },
59
              {
60
                name: 'deploymentData',
61
                type: 'bytes',
62
                internalType: 'bytes',
63
              },
64
            ],
65
            outputs: [
66
              {
67
                name: 'newContract',
68
                type: 'address',
69
                internalType: 'address',
70
              },
71
            ],
72
            stateMutability: 'nonpayable',
73
          },
74
          {
75
            name: 'performCreate2',
76
            type: 'function',
77
            inputs: [
78
              {
79
                name: 'value',
80
                type: 'uint256',
81
                internalType: 'uint256',
82
              },
83
              {
84
                name: 'deploymentData',
85
                type: 'bytes',
86
                internalType: 'bytes',
87
              },
88
              {
89
                name: 'salt',
90
                type: 'bytes32',
91
                internalType: 'bytes32',
92
              },
93
            ],
94
            outputs: [
95
              {
96
                name: 'newContract',
97
                type: 'address',
98
                internalType: 'address',
99
              },
100
            ],
101
            stateMutability: 'nonpayable',
102
          },
103
        ],
104
        description: 'CreateCall',
105
        relevance: 100,
106
      },
107
      trustedForDelegateCall: false,
108
    };
109

110
    await request(app.getHttpServer())
×
111
      .get(`/v1/chains/${chainId}/contracts/${contractAddress}`)
112
      .expect(200)
113
      .then(({ body }) => {
114
        expect(body).toEqual(expectedResponse);
×
115
      });
116

117
    const cacheContent = await redisClient.hGet(
×
118
      `${chainId}_contract_${contractAddress}`,
119
      '',
120
    );
121
    expect(cacheContent).toEqual(JSON.stringify(expectedResponse));
×
122
  });
123

124
  afterAll(async () => {
×
125
    await app.close();
×
126
    await redisClient.flushAll();
×
127
    await redisClient.quit();
×
128
  });
129
});
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

© 2025 Coveralls, Inc