Skip to content

Commit b13934e

Browse files
authored
Merge pull request #399 from NEMStudios/task/g397_apply_open_api
Apply latest OpenAPI 0.7.20.6
2 parents e9ed91c + 97ffec1 commit b13934e

File tree

237 files changed

+1283
-1163
lines changed

Some content is hidden

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

237 files changed

+1283
-1163
lines changed

e2e/infrastructure/AccountHttp.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ import { MultisigAccountModificationTransaction } from '../../src/model/transact
3333
import { NamespaceRegistrationTransaction } from '../../src/model/transaction/NamespaceRegistrationTransaction';
3434
import { TransferTransaction } from '../../src/model/transaction/TransferTransaction';
3535
import { UInt64 } from '../../src/model/UInt64';
36-
import { IntegrationTestHelper } from "./IntegrationTestHelper";
36+
import { IntegrationTestHelper } from './IntegrationTestHelper';
3737

3838
describe('AccountHttp', () => {
39-
let helper = new IntegrationTestHelper();
39+
const helper = new IntegrationTestHelper();
4040
let account: Account;
4141
let account2: Account;
4242
let multisigAccount: Account;
@@ -93,7 +93,7 @@ describe('AccountHttp', () => {
9393
[NetworkCurrencyMosaic.createAbsolute(1)],
9494
PlainMessage.create('test-message'),
9595
networkType,
96-
helper.maxFee
96+
helper.maxFee,
9797
);
9898

9999
const signedTransaction = transferTransaction.signWith(account, generationHash);
@@ -109,7 +109,7 @@ describe('AccountHttp', () => {
109109
namespaceName,
110110
UInt64.fromUint(9),
111111
networkType,
112-
helper.maxFee
112+
helper.maxFee,
113113
);
114114
namespaceId = new NamespaceId(namespaceName);
115115
const signedTransaction = registerNamespaceTransaction.signWith(account, generationHash);
@@ -265,7 +265,7 @@ describe('AccountHttp', () => {
265265
namespaceId,
266266
account.address,
267267
networkType,
268-
helper.maxFee
268+
helper.maxFee,
269269
);
270270
const signedTransaction = addressAliasTransaction.signWith(account, generationHash);
271271
return helper.announce(signedTransaction);
@@ -282,7 +282,7 @@ describe('AccountHttp', () => {
282282
[cosignAccount1.publicAccount,
283283
],
284284
networkType,
285-
helper.maxFee
285+
helper.maxFee,
286286
);
287287
const removeCosigner2 = MultisigAccountModificationTransaction.create(
288288
Deadline.create(),
@@ -293,7 +293,7 @@ describe('AccountHttp', () => {
293293
cosignAccount2.publicAccount,
294294
],
295295
networkType,
296-
helper.maxFee
296+
helper.maxFee,
297297
);
298298

299299
const removeCosigner3 = MultisigAccountModificationTransaction.create(
@@ -305,7 +305,7 @@ describe('AccountHttp', () => {
305305
cosignAccount3.publicAccount,
306306
],
307307
networkType,
308-
helper.maxFee
308+
helper.maxFee,
309309
);
310310

311311
const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(),

e2e/infrastructure/BlockHttp.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
import { expect } from 'chai';
1818
import { mergeMap } from 'rxjs/operators';
1919
import { BlockHttp } from '../../src/infrastructure/BlockHttp';
20+
import { BlockRepository } from '../../src/infrastructure/BlockRepository';
2021
import { QueryParams } from '../../src/infrastructure/QueryParams';
22+
import { ReceiptRepository } from '../../src/infrastructure/ReceiptRepository';
2123
import { Account } from '../../src/model/account/Account';
2224
import { NetworkType } from '../../src/model/blockchain/NetworkType';
2325
import { PlainMessage } from '../../src/model/message/PlainMessage';
2426
import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic';
2527
import { Deadline } from '../../src/model/transaction/Deadline';
2628
import { TransactionInfo } from '../../src/model/transaction/TransactionInfo';
2729
import { TransferTransaction } from '../../src/model/transaction/TransferTransaction';
28-
import { IntegrationTestHelper } from "./IntegrationTestHelper";
29-
import { BlockRepository } from "../../src/infrastructure/BlockRepository";
30-
import { ReceiptRepository } from "../../src/infrastructure/ReceiptRepository";
30+
import { IntegrationTestHelper } from './IntegrationTestHelper';
3131

3232
describe('BlockHttp', () => {
33-
let helper = new IntegrationTestHelper();
33+
const helper = new IntegrationTestHelper();
3434
let account: Account;
3535
let account2: Account;
3636
let blockRepository: BlockRepository;
@@ -68,18 +68,17 @@ describe('BlockHttp', () => {
6868

6969
describe('Setup Test Data', () => {
7070

71-
7271
it('Announce TransferTransaction', (done) => {
7372
const transferTransaction = TransferTransaction.create(
7473
Deadline.create(),
7574
account2.address,
7675
[NetworkCurrencyMosaic.createAbsolute(1)],
7776
PlainMessage.create('test-message'),
7877
networkType,
79-
helper.maxFee
78+
helper.maxFee,
8079
);
8180
const signedTransaction = transferTransaction.signWith(account, generationHash);
82-
helper.announce(signedTransaction).then(transaction => {
81+
helper.announce(signedTransaction).then((transaction) => {
8382
chainHeight = transaction.transactionInfo!.height.toString();
8483
return transaction;
8584
});

e2e/infrastructure/ChainHttp.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
*/
1616

1717
import { expect } from 'chai';
18-
import { ChainHttp } from '../../src/infrastructure/ChainHttp';
19-
import { IntegrationTestHelper } from "./IntegrationTestHelper";
20-
import { ChainRepository } from "../../src/infrastructure/ChainRepository";
18+
import { ChainRepository } from '../../src/infrastructure/ChainRepository';
19+
import { IntegrationTestHelper } from './IntegrationTestHelper';
2120

2221
describe('ChainHttp', () => {
23-
let helper = new IntegrationTestHelper();
22+
const helper = new IntegrationTestHelper();
2423
let chainRepository: ChainRepository;
2524

2625
before(() => {

e2e/infrastructure/DiagnosticHttp.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
*/
1616

1717
import { expect } from 'chai';
18-
import { DiagnosticHttp } from '../../src/infrastructure/DiagnosticHttp';
19-
import { IntegrationTestHelper } from "./IntegrationTestHelper";
20-
import { DiagnosticRepository } from "../../src/infrastructure/DiagnosticRepository";
18+
import { DiagnosticRepository } from '../../src/infrastructure/DiagnosticRepository';
19+
import { IntegrationTestHelper } from './IntegrationTestHelper';
2120

2221
describe('DiagnosticHttp', () => {
23-
let helper = new IntegrationTestHelper();
22+
const helper = new IntegrationTestHelper();
2423
let diagnosticRepository: DiagnosticRepository;
2524

2625
before(() => {

e2e/infrastructure/IntegrationTestHelper.ts

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import { Account } from "../../src/model/account/Account";
17-
import { RepositoryFactoryHttp } from "../../src/infrastructure/RepositoryFactoryHttp";
18-
import { RepositoryFactory } from "../../src/infrastructure/RepositoryFactory";
19-
import { NetworkType } from "../../src/model/blockchain/NetworkType";
20-
import { combineLatest } from "rxjs";
21-
import { IListener } from "../../src/infrastructure/IListener";
22-
import { SignedTransaction } from "../../src/model/transaction/SignedTransaction";
23-
import { filter } from "rxjs/operators";
24-
import { Transaction } from "../../src/model/transaction/Transaction";
25-
import { UInt64 } from "../../src/model/UInt64";
26-
27-
const yaml = require('js-yaml');
16+
import { combineLatest } from 'rxjs';
17+
import { filter } from 'rxjs/operators';
18+
import { IListener } from '../../src/infrastructure/IListener';
19+
import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory';
20+
import { RepositoryFactoryHttp } from '../../src/infrastructure/RepositoryFactoryHttp';
21+
import { Account } from '../../src/model/account/Account';
22+
import { NetworkType } from '../../src/model/blockchain/NetworkType';
23+
import { SignedTransaction } from '../../src/model/transaction/SignedTransaction';
24+
import { Transaction } from '../../src/model/transaction/Transaction';
25+
import { UInt64 } from '../../src/model/UInt64';
2826

2927
export class IntegrationTestHelper {
30-
28+
public readonly yaml = require('js-yaml');
3129
public apiUrl: string;
3230
public repositoryFactory: RepositoryFactory;
3331
public account: Account;
@@ -57,7 +55,8 @@ export class IntegrationTestHelper {
5755
console.log(`Running tests against: ${json.apiUrl}`);
5856
this.apiUrl = json.apiUrl;
5957
this.repositoryFactory = new RepositoryFactoryHttp(json.apiUrl);
60-
combineLatest(this.repositoryFactory.getGenerationHash(), this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => {
58+
combineLatest(this.repositoryFactory.getGenerationHash(),
59+
this.repositoryFactory.getNetworkType()).subscribe(([generationHash, networkType]) => {
6160
this.networkType = networkType;
6261
this.generationHash = generationHash;
6362
this.account = this.createAccount(json.testAccount);
@@ -71,15 +70,18 @@ export class IntegrationTestHelper {
7170
this.harvestingAccount = this.createAccount(json.harvestingAccount);
7271
this.listener = this.repositoryFactory.createListener();
7372

74-
this.maxFee = UInt64.fromUint(1000000); //What would be the best maxFee? In the future we will load the fee multiplier from rest.
75-
73+
// What would be the best maxFee? In the future we will load the fee multiplier from rest.
74+
this.maxFee = UInt64.fromUint(1000000);
7675

77-
require('fs').readFile(path.resolve(__dirname, '../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'), (err, yamlData) => {
78-
if (err) {
79-
console.log(`catapult-service-bootstrap generated address could not be loaded. Ignoring and using accounts from network.conf. Error: ${err}`);
76+
require('fs').readFile(path.resolve(__dirname,
77+
'../../../catapult-service-bootstrap/build/generated-addresses/addresses.yaml'),
78+
(error: any, yamlData: any) => {
79+
if (error) {
80+
console.log(`catapult-service-bootstrap generated address could not be loaded.
81+
Ignoring and using accounts from network.conf. Error: ${error}`);
8082
return resolve(this);
8183
} else {
82-
const parsedYaml = yaml.safeLoad(yamlData);
84+
const parsedYaml = this.yaml.safeLoad(yamlData);
8385
this.account = this.createAccount(parsedYaml.nemesis_addresses[0]);
8486
this.account2 = this.createAccount(parsedYaml.nemesis_addresses[1]);
8587
this.account3 = this.createAccount(parsedYaml.nemesis_addresses[2]);
@@ -91,15 +93,14 @@ export class IntegrationTestHelper {
9193
}
9294
});
9395
}, (error) => {
94-
console.log("There has been an error loading the configuration. ", error)
96+
console.log('There has been an error loading the configuration. ', error);
9597
return reject(error);
9698
});
9799
});
98100

99-
100-
}
101+
},
101102
);
102-
};
103+
}
103104

104105
createAccount(data): Account {
105106
return Account.createFromPrivateKey(data.privateKey ? data.privateKey : data.private, this.networkType);
@@ -114,12 +115,12 @@ export class IntegrationTestHelper {
114115
console.log(`Transaction ${signedTransaction.type} confirmed`);
115116
resolve(transaction);
116117
});
117-
this.listener.status(address).pipe(filter(status => status.hash === signedTransaction.hash)).subscribe((error) => {
118+
this.listener.status(address).pipe(filter((status) => status.hash === signedTransaction.hash)).subscribe((error) => {
118119
console.log(`Error processing transaction ${signedTransaction.type}`, error);
119120
reject(error);
120121
});
121122
this.repositoryFactory.createTransactionRepository().announce(signedTransaction);
122-
}
123+
},
123124
);
124-
};
125+
}
125126
}

0 commit comments

Comments
 (0)