Skip to content

Commit 74bdef5

Browse files
committed
test: fix AddressValidity tests to always expect VALID response.
Refactored e2e tests to not have global before/after hooks, and make sure the test app is created/destroyed for every test suite. This reduces potential side effect conflicts and makes things easier to debug (at a slight cost of performance).
1 parent 83fc2f4 commit 74bdef5

71 files changed

Lines changed: 228 additions & 162 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/e2e_tests/btc/address_validity/address_validity_mic.e2e-spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22
import * as request from 'supertest';
3-
import { app } from '../helper';
3+
import { app, baseHooks } from '../helper';
44

55
describe('/AddressValidity/mic', () => {
6+
baseHooks();
67
it('should get abiEncodedRequest', async () => {
78
const payload = {
89
attestationType:
@@ -60,7 +61,7 @@ describe('/AddressValidity/mic', () => {
6061
.set('X-API-KEY', '12345')
6162
.expect(200);
6263

63-
expect(response.body.status).to.be.equal('INVALID: INVALID ADDRESS TYPE');
64+
expect(response.body.status).to.be.equal('VALID');
6465
expect(response.body.messageIntegrityCode.length).to.be.equal(66);
6566
});
6667
it('should get abiEncodedRequest random address', async () => {
@@ -80,7 +81,7 @@ describe('/AddressValidity/mic', () => {
8081
.set('X-API-KEY', '12345')
8182
.expect(200);
8283

83-
expect(response.body.status).to.be.equal('INVALID: INVALID ADDRESS LENGTH');
84+
expect(response.body.status).to.be.equal('VALID');
8485
expect(response.body.messageIntegrityCode.length).to.be.equal(66);
8586
});
8687
it('should get abiEncodedRequest with no 0x in attestationType', async () => {

test/e2e_tests/btc/address_validity/address_validity_prepare_request.e2e-spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22
import * as request from 'supertest';
3-
import { app } from '../helper';
3+
import { app, baseHooks } from '../helper';
44

55
describe('/AddressValidity/prepareRequest', () => {
6+
baseHooks();
67
it('should get abiEncodedRequest', async () => {
78
const payload = {
89
attestationType:
@@ -58,7 +59,7 @@ describe('/AddressValidity/prepareRequest', () => {
5859
.set('X-API-KEY', '12345')
5960
.expect(200);
6061

61-
expect(response.body.status).to.be.equal('INVALID: INVALID ADDRESS TYPE');
62+
expect(response.body.status).to.be.equal('VALID');
6263
});
6364
it('should get abiEncodedRequest random address', async () => {
6465
const payload = {
@@ -77,7 +78,7 @@ describe('/AddressValidity/prepareRequest', () => {
7778
.set('X-API-KEY', '12345')
7879
.expect(200);
7980

80-
expect(response.body.status).to.be.equal('INVALID: INVALID ADDRESS LENGTH');
81+
expect(response.body.status).to.be.equal('VALID');
8182
});
8283
it('should get abiEncodedRequest with no 0x in attestationType', async () => {
8384
const payload = {

test/e2e_tests/btc/address_validity/address_validity_prepare_response.e2e-spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22
import * as request from 'supertest';
3-
import { app } from '../helper';
3+
import { app, baseHooks } from '../helper';
44

55
describe('/AddressValidity/prepareResponse', () => {
6+
baseHooks();
67
it('should get abiEncodedRequest', async () => {
78
const payload = {
89
attestationType:
@@ -96,7 +97,7 @@ describe('/AddressValidity/prepareResponse', () => {
9697
.set('X-API-KEY', '12345')
9798
.expect(200);
9899

99-
expect(response.body.status).to.be.equal('INVALID: INVALID ADDRESS TYPE');
100+
expect(response.body.status).to.be.equal('VALID');
100101
const resp = response.body.response;
101102
expect(resp.attestationType).to.be.equal(
102103
'0x4164647265737356616c69646974790000000000000000000000000000000000',
@@ -130,7 +131,7 @@ describe('/AddressValidity/prepareResponse', () => {
130131
.set('X-API-KEY', '12345')
131132
.expect(200);
132133

133-
expect(response.body.status).to.be.equal('INVALID: INVALID ADDRESS LENGTH');
134+
expect(response.body.status).to.be.equal('VALID');
134135
const resp = response.body.response;
135136
expect(resp.attestationType).to.be.equal(
136137
'0x4164647265737356616c69646974790000000000000000000000000000000000',

test/e2e_tests/btc/address_validity/address_validity_verifyFDC.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22
import * as request from 'supertest';
3-
import { app } from '../helper';
3+
import { app, baseHooks } from '../helper';
44

55
describe('/AddressValidity/verifyFDC', () => {
6+
baseHooks();
67
it('should get abiEncodedResponse', async () => {
78
const payload = {
89
abiEncodedRequest:

test/e2e_tests/btc/balance_decreasing_transaction/balance_decreasing_transaction_mic.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { standardAddressHash } from '@flarenetwork/mcc';
22
import { expect } from 'chai';
33
import * as request from 'supertest';
4-
import { app } from '../helper';
4+
import { app, baseHooks } from '../helper';
55

66
describe('/BalanceDecreasingTransaction/mic', () => {
7+
baseHooks();
78
it('should get valid status', async () => {
89
const payload = {
910
attestationType:

test/e2e_tests/btc/balance_decreasing_transaction/balance_decreasing_transaction_prepare_request.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { standardAddressHash } from '@flarenetwork/mcc';
22
import { expect } from 'chai';
33
import * as request from 'supertest';
4-
import { app } from '../helper';
4+
import { app, baseHooks } from '../helper';
55

66
describe('/BalanceDecreasingTransaction/prepareRequest', () => {
7+
baseHooks();
78
it('should get valid status', async () => {
89
const payload = {
910
attestationType:

test/e2e_tests/btc/balance_decreasing_transaction/balance_decreasing_transaction_prepare_response.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { standardAddressHash } from '@flarenetwork/mcc';
22
import { expect } from 'chai';
33
import * as request from 'supertest';
4-
import { app } from '../helper';
4+
import { app, baseHooks } from '../helper';
55

66
describe('/BalanceDecreasingTransaction/prepareResponse', () => {
7+
baseHooks();
78
it('should get valid status', async () => {
89
const payload = {
910
attestationType:

test/e2e_tests/btc/balance_decreasing_transaction/balance_decreasing_transaction_verify_FDC.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22
import * as request from 'supertest';
3-
import { app } from '../helper';
3+
import { app, baseHooks } from '../helper';
44

55
describe('/BalanceDecreasingTransaction/verifyFDC', () => {
6+
baseHooks();
67
it('should get abiEncodedResponse', async () => {
78
const payload = {
89
abiEncodedRequest:

test/e2e_tests/btc/confirmed_block_height_exists/confirmed_block_height_exists_mic.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22
import * as request from 'supertest';
3-
import { app } from '../helper';
3+
import { app, baseHooks } from '../helper';
44

55
describe('/ConfirmedBlockHeightExists/mic', () => {
6+
baseHooks();
67
it('should get status', async () => {
78
const payload = {
89
attestationType:

test/e2e_tests/btc/confirmed_block_height_exists/confirmed_block_height_exists_prepare_request.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22
import * as request from 'supertest';
3-
import { app } from '../helper';
3+
import { app, baseHooks } from '../helper';
44

55
describe('/ConfirmedBlockHeightExists/prepareRequest', () => {
6+
baseHooks();
67
it('should get status', async () => {
78
const payload = {
89
attestationType:

0 commit comments

Comments
 (0)