Skip to content

Commit 3640ee6

Browse files
authored
typescript-fetch rest client migration
1 parent 73bb755 commit 3640ee6

File tree

71 files changed

+907
-1242
lines changed

Some content is hidden

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

71 files changed

+907
-1242
lines changed

e2e/infrastructure/AccountHttp.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { expect } from 'chai';
1818
import { AccountRepository } from '../../src/infrastructure/AccountRepository';
1919
import { MultisigRepository } from '../../src/infrastructure/MultisigRepository';
2020
import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository';
21+
import { RepositoryCallError } from '../../src/infrastructure/RepositoryCallError';
2122
import { Account } from '../../src/model/account/Account';
2223
import { Address } from '../../src/model/account/Address';
2324
import { PlainMessage } from '../../src/model/message/PlainMessage';
@@ -187,9 +188,9 @@ describe('AccountHttp', () => {
187188
return Promise.reject('should fail!');
188189
},
189190
(err) => {
190-
const error = JSON.parse(err.message);
191+
const error: RepositoryCallError = JSON.parse(err.message);
191192
expect(error.statusCode).to.be.eq(404);
192-
expect(error.errorDetails.statusMessage).to.be.eq('Not Found');
193+
expect(error.statusMessage).to.be.eq('Not Found');
193194
return Promise.resolve();
194195
},
195196
);

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,11 +1495,37 @@ describe('TransactionHttp', () => {
14951495
.toPromise();
14961496
expect(transactions.data.length).to.be.greaterThan(0);
14971497
});
1498-
it('should return transaction info given height', async () => {
1498+
it('should return transaction info given height all types', async () => {
14991499
const transactions = await transactionRepository
15001500
.search({ group: TransactionGroup.Confirmed, height: UInt64.fromUint(1) } as TransactionSearchCriteria)
15011501
.toPromise();
1502-
expect(transactions.data.length).to.be.greaterThan(0);
1502+
1503+
const mosaicDefinitions = transactions.data.filter((t) => t.type == TransactionType.MOSAIC_DEFINITION).length;
1504+
const namespaceRegistration = transactions.data.filter((t) => t.type == TransactionType.NAMESPACE_REGISTRATION).length;
1505+
const others = transactions.data.filter(
1506+
(t) => t.type !== TransactionType.NAMESPACE_REGISTRATION && t.type !== TransactionType.MOSAIC_DEFINITION,
1507+
).length;
1508+
expect(mosaicDefinitions).to.be.greaterThan(0);
1509+
expect(namespaceRegistration).to.be.greaterThan(0);
1510+
expect(others).to.be.greaterThan(0);
1511+
});
1512+
1513+
it('should return transaction info given height and namesapce, mosaic types', async () => {
1514+
const transactions = await transactionRepository
1515+
.search({
1516+
group: TransactionGroup.Confirmed,
1517+
height: UInt64.fromUint(1),
1518+
type: [TransactionType.MOSAIC_DEFINITION, TransactionType.NAMESPACE_REGISTRATION],
1519+
} as TransactionSearchCriteria)
1520+
.toPromise();
1521+
const mosaicDefinitions = transactions.data.filter((t) => t.type == TransactionType.MOSAIC_DEFINITION).length;
1522+
const namespaceRegistration = transactions.data.filter((t) => t.type == TransactionType.NAMESPACE_REGISTRATION).length;
1523+
const others = transactions.data.filter(
1524+
(t) => t.type !== TransactionType.NAMESPACE_REGISTRATION && t.type !== TransactionType.MOSAIC_DEFINITION,
1525+
).length;
1526+
expect(mosaicDefinitions).to.be.greaterThan(0);
1527+
expect(namespaceRegistration).to.be.greaterThan(0);
1528+
expect(others).to.eq(0);
15031529
});
15041530
});
15051531

0 commit comments

Comments
 (0)