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

safe-global / safe-client-gateway-nest / 5356629757

Canceled at 31 May 2024 04:53AM UTC via web
5356629757

push

github

hectorgomezv
Move its logic to a separated MultisigTransactionExecutionDetailsMapper

848 of 1029 branches covered (82.41%)

Branch coverage included in aggregate %.

4167 of 4412 relevant lines covered (94.45%)

51.5 hits per line

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

0.0
/src/routes/data-decode/__tests__/data-decode.e2e-spec.ts
1
import { faker } from '@faker-js/faker';
×
2
import { INestApplication } from '@nestjs/common';
3
import { Test } from '@nestjs/testing';
×
4
import { readFileSync } from 'fs';
×
5
import { RedisClientType } from 'redis';
6
import * as request from 'supertest';
×
7
import { AppModule } from '../../../app.module';
×
8
import { TestAppProvider } from '../../../app.provider';
×
9
import { DataDecoded } from '../../../domain/data-decoder/entities/data-decoded.entity';
10
import { redisClientFactory } from '../../../__tests__/redis-client.factory';
×
11
import { GetDataDecodedDto } from '../entities/get-data-decoded.dto.entity';
12

13
describe('Data decode e2e tests', () => {
×
14
  let app: INestApplication;
15
  let redisClient: RedisClientType;
16
  const chainId = '5'; // Görli testnet
×
17

18
  beforeAll(async () => {
×
19
    const moduleRef = await Test.createTestingModule({
×
20
      imports: [AppModule],
21
    }).compile();
22

23
    app = await new TestAppProvider().provide(moduleRef);
×
24
    await app.init();
×
25
    redisClient = await redisClientFactory();
×
26
  });
27

28
  beforeEach(async () => {
×
29
    await redisClient.flushAll();
×
30
  });
31

32
  it('POST /data-decoder', async () => {
×
33
    const requestBody: GetDataDecodedDto = JSON.parse(
×
34
      readFileSync(
35
        'src/routes/data-decode/__tests__/resources/data-decode-request-body.json',
36
        {
37
          encoding: 'utf-8',
38
        },
39
      ),
40
    );
41
    const expectedResponse: DataDecoded = JSON.parse(
×
42
      readFileSync(
43
        'src/routes/data-decode/__tests__/resources/data-decode-expected-response.json',
44
        {
45
          encoding: 'utf-8',
46
        },
47
      ),
48
    );
49

50
    await request(app.getHttpServer())
×
51
      .post(`/v1/chains/${chainId}/data-decoder`)
52
      .send(requestBody)
53
      .expect(200)
54
      .then(({ body }) => {
55
        expect(body).toEqual(expectedResponse);
×
56
      });
57
  });
58

59
  it('POST /data-decoder should throw a validation error', async () => {
×
60
    const requestBody: GetDataDecodedDto = JSON.parse(
×
61
      readFileSync(
62
        'src/routes/data-decode/__tests__/resources/data-decode-request-body.json',
63
        {
64
          encoding: 'utf-8',
65
        },
66
      ),
67
    );
68

69
    await request(app.getHttpServer())
×
70
      .post(`/v1/chains/${chainId}/data-decoder`)
71
      .send({ ...requestBody, to: faker.number.int() })
72
      .expect(400)
73
      .expect({ message: 'Validation failed', code: 42, arguments: [] });
74
  });
75

76
  it('POST /data-decoder should throw a validation error (2)', async () => {
×
77
    const requestBody: GetDataDecodedDto = JSON.parse(
×
78
      readFileSync(
79
        'src/routes/data-decode/__tests__/resources/data-decode-request-body.json',
80
        {
81
          encoding: 'utf-8',
82
        },
83
      ),
84
    );
85

86
    await request(app.getHttpServer())
×
87
      .post(`/v1/chains/${chainId}/data-decoder`)
88
      .send({ ...requestBody, to: faker.string.alphanumeric() })
89
      .expect(400)
90
      .expect({ message: 'Validation failed', code: 42, arguments: [] });
91
  });
92

93
  afterAll(async () => {
×
94
    await app.close();
×
95
    await redisClient.flushAll();
×
96
    await redisClient.quit();
×
97
  });
98
});
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