Skip to content

Commit

Permalink
remove logs
Browse files Browse the repository at this point in the history
Signed-off-by: svetoslav-nikol0v <[email protected]>
  • Loading branch information
svetoslav-nikol0v committed May 28, 2024
1 parent fecf2d3 commit 8e113a7
Show file tree
Hide file tree
Showing 30 changed files with 100 additions and 139 deletions.
1 change: 0 additions & 1 deletion src/client/ManagedNetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ export default class ManagedNetwork {
this._nodes = newNodes;
this._healthyNodes = newHealthyNodes;
this._network = newNetwork;
this._ledgerId = null;

return this;
}
Expand Down
30 changes: 16 additions & 14 deletions test/integration/AccountBalanceIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ describe("AccountBalanceQuery", function () {
expect(balance.hbars.toTinybars().compare(0)).to.be.equal(1);
});

// TODO(2023-11-01 NK) - test is consistently failing and should be enabled once fixed.
// eslint-disable-next-line mocha/no-skipped-tests
xit("can connect to previewnet with TLS", async function () {
this.timeout(30000);
it("can connect to previewnet with TLS", async function () {
this.timeout(120000);
if (skipTestDueToNodeJsVersion(16)) {
return;
}
Expand All @@ -42,16 +40,18 @@ describe("AccountBalanceQuery", function () {
)) {
expect(address.endsWith(":50212")).to.be.true;

await new AccountBalanceQuery()
.setTimeout(1000)
const balance = await new AccountBalanceQuery()
.setTimeout(3000)
.setAccountId(nodeAccountId)
.setMaxAttempts(10)
.execute(clientPreviewNet);

expect(balance.hbars).to.not.be.null;
}
});

it("can connect to testnet with TLS", async function () {
this.timeout(30000);
this.timeout(120000);

if (skipTestDueToNodeJsVersion(16)) {
return;
Expand All @@ -62,11 +62,13 @@ describe("AccountBalanceQuery", function () {
)) {
expect(address.endsWith(":50212")).to.be.true;

await new AccountBalanceQuery()
.setTimeout(1000)
.setAccountId(nodeAccountId)
.setMaxAttempts(10)
.execute(clientTestnet);
const balance = await new AccountBalanceQuery()
.setTimeout(3000)
.setAccountId(nodeAccountId)
.setMaxAttempts(10)
.execute(clientTestnet);

expect(balance.hbars).to.not.be.null;
}
});

Expand All @@ -89,7 +91,7 @@ describe("AccountBalanceQuery", function () {
});

it("should reflect token with no keys", async function () {
this.timeout(120000);
this.timeout(30000);

const operatorId = env.operatorId;

Expand All @@ -104,7 +106,7 @@ describe("AccountBalanceQuery", function () {
).tokenId;

const balances = await new AccountBalanceQuery()
.setTimeout(2000)
.setTimeout(3000)
.setAccountId(env.operatorId)
.execute(env.client);

Expand Down
18 changes: 9 additions & 9 deletions test/integration/AccountCreateIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("AccountCreate", function () {
const account = receipt.accountId;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(account)
.execute(env.client);

Expand Down Expand Up @@ -77,7 +77,7 @@ describe("AccountCreate", function () {
const account = receipt.accountId;

const info = await new AccountInfoQuery()
.setTimeout(2000)
.setTimeout(3000)
.setNodeAccountIds([response.nodeId])
.setAccountId(account)
.execute(env.client);
Expand Down Expand Up @@ -119,7 +119,7 @@ describe("AccountCreate", function () {
const account = receipt.accountId;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(account)
.execute(env.client);

Expand Down Expand Up @@ -176,7 +176,7 @@ describe("AccountCreate", function () {
const account = receipt.accountId;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setNodeAccountIds([response.nodeId])
.setAccountId(account)
.execute(env.client);
Expand Down Expand Up @@ -222,7 +222,7 @@ describe("AccountCreate", function () {
expect(accountId).to.not.be.null;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setNodeAccountIds([txAccountCreate.nodeId])
.setAccountId(accountId)
.execute(env.client);
Expand Down Expand Up @@ -260,7 +260,7 @@ describe("AccountCreate", function () {
expect(accountId).to.not.be.null;

const info = await new AccountInfoQuery()
.setTimeout(2000)
.setTimeout(3000)
.setAccountId(accountId)
.execute(env.client);

Expand Down Expand Up @@ -302,7 +302,7 @@ describe("AccountCreate", function () {
expect(accountId).to.not.be.null;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(accountId)
.execute(env.client);

Expand Down Expand Up @@ -376,7 +376,7 @@ describe("AccountCreate", function () {
expect(accountId).to.not.be.null;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(accountId)
.execute(env.client);

Expand Down Expand Up @@ -455,7 +455,7 @@ describe("AccountCreate", function () {
expect(accountId).to.not.be.null;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(accountId)
.execute(env.client);

Expand Down
2 changes: 1 addition & 1 deletion test/integration/AccountDeleteIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("AccountDelete", function () {
const account = receipt.accountId;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(account)
.execute(env.client);

Expand Down
4 changes: 2 additions & 2 deletions test/integration/AccountInfoIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("AccountInfo", function () {
const account = receipt.accountId;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(account)
.execute(env.client);

Expand Down Expand Up @@ -171,7 +171,7 @@ describe("AccountInfo", function () {
).tokenId;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(operatorId)
.execute(env.client);

Expand Down
2 changes: 1 addition & 1 deletion test/integration/AccountUpdateIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("AccountUpdate", function () {
const account = receipt.accountId;

let info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(account)
.execute(env.client);

Expand Down
16 changes: 10 additions & 6 deletions test/integration/ClientIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,30 @@ describe("ClientIntegration", function () {

let err = false;

let network;
switch (env.client.ledgerId.toString()) {
case "mainnet":
network = "testnet";
env.client.setLedgerId(LedgerId.TESTNET);
break;
case "testnet":
network = "previewnet";
env.client.setLedgerId(LedgerId.PREVIEWNET);
break;
case "previewnet":
network = "mainnet";
env.client.setLedgerId(LedgerId.LOCAL_NODE);
break;
case "local-node":
env.client.setLedgerId(LedgerId.MAINNET);
break;
default:
throw new Error(
`(BUG) operator network is unrecognized value: ${env.client.ledgerId.toString()}`,
);
}

const accountId = AccountId.withNetwork(3, network);
const accountId = new AccountId(3);

try {
await new AccountInfoQuery()
.setTimeout(3000)
.setAccountId(accountId)
.execute(env.client);
} catch (error) {
Expand Down Expand Up @@ -81,10 +84,11 @@ describe("ClientIntegration", function () {
const account = receipt.accountId;

const info = await new AccountInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setAccountId(account)
.execute(env.client);

expect(info).to.not.be.null;
expect(info.accountId.toString()).to.be.equal(account.toString());
expect(info.isDeleted).to.be.false;
expect(info.key.toString()).to.be.equal(key.publicKey.toString());
Expand Down
2 changes: 1 addition & 1 deletion test/integration/ContractCreateIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("ContractCreate", function () {
let contract = receipt.contractId;

let info = await new ContractInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setContractId(contract)
.setQueryPayment(new Hbar(1))
.execute(env.client);
Expand Down
21 changes: 3 additions & 18 deletions test/integration/ContractFunctionParametersIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ describe("ContractFunctionParameters", function () {
const fileCreateSubmit = await fileCreateSign.execute(env.client);
const fileCreateRx = await fileCreateSubmit.getReceipt(env.client);
const bytecodeFileId = fileCreateRx.fileId;
console.log(`- The bytecode file ID is: ${bytecodeFileId} \n`);

//Append contents to the file
const fileAppendTx = new FileAppendTransaction()
Expand All @@ -142,11 +141,7 @@ describe("ContractFunctionParameters", function () {
.freezeWith(env.client);
const fileAppendSign = await fileAppendTx.sign(env.operatorKey);
const fileAppendSubmit = await fileAppendSign.execute(env.client);
const fileAppendRx = await fileAppendSubmit.getReceipt(env.client);
console.log(
"Status of file append is",
fileAppendRx.status.toString(10),
);
await fileAppendSubmit.getReceipt(env.client);

// Instantiate the contract instance
const contractTx = new ContractCreateTransaction()
Expand All @@ -165,9 +160,6 @@ describe("ContractFunctionParameters", function () {

//Get the smart contract ID
newContractId = contractReceipt.contractId;

//Log the smart contract ID
console.log("The smart contract ID is " + newContractId);
});

bitSizes.forEach((bitSize) => {
Expand Down Expand Up @@ -1018,7 +1010,6 @@ describe("ContractFunctionParameters", function () {
const contractCreateRecord = await contractCreate.getRecord(env.client);
const nonces =
contractCreateRecord.contractFunctionResult.contractNonces;
console.log(`contractNonces: ${JSON.stringify(nonces)}`);

const contractId = contractCreateRecord.receipt.contractId;
const contractAnonce = nonces.find(
Expand All @@ -1038,19 +1029,13 @@ describe("ContractFunctionParameters", function () {
.setContractId(contractId)
.execute(env.client);

const contractDeleteResult = await contractDeleteTx.getReceipt(
env.client,
);
console.log(
`contractDelete status: ${contractDeleteResult.status.toString()}`,
);
await contractDeleteTx.getReceipt(env.client);

const fileDeleteTx = await new FileDeleteTransaction()
.setFileId(fileId)
.execute(env.client);

const fileDeleteResult = await fileDeleteTx.getReceipt(env.client);
console.log(`fileDelete status: ${fileDeleteResult.status.toString()}`);
await fileDeleteTx.getReceipt(env.client);
});

after(async function () {
Expand Down
5 changes: 3 additions & 2 deletions test/integration/ContractInfoIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe("ContractInfo", function () {
before(async function () {
env = await IntegrationTestEnv.new();
});

it("should be executable", async function () {
this.timeout(120000);

Expand Down Expand Up @@ -57,7 +58,7 @@ describe("ContractInfo", function () {
let contract = receipt.contractId;

let info = await new ContractInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setContractId(contract)
.setQueryPayment(new Hbar(1))
.execute(env.client);
Expand Down Expand Up @@ -127,7 +128,7 @@ describe("ContractInfo", function () {
let contract = receipt.contractId;

let info = await new ContractInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setContractId(contract)
.setQueryPayment(new Hbar(1))
.execute(env.client);
Expand Down
4 changes: 2 additions & 2 deletions test/integration/ContractUpdateIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("ContractUpdate", function () {
let contract = receipt.contractId;

let info = await new ContractInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setContractId(contract)
.setQueryPayment(new Hbar(1))
.execute(env.client);
Expand All @@ -86,7 +86,7 @@ describe("ContractUpdate", function () {
).getReceipt(env.client);

info = await new ContractInfoQuery()
.setTimeout(1000)
.setTimeout(3000)
.setContractId(contract)
.setQueryPayment(new Hbar(5))
.execute(env.client);
Expand Down
1 change: 0 additions & 1 deletion test/integration/CustomFeesIntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,6 @@ describe("CustomFees", function () {
.execute(env.client)
).getReceipt(env.client);
} catch (error) {
console.log(error);
err = error
.toString()
.includes(Status.CustomFeeChargingExceededMaxAccountAmounts);
Expand Down
Loading

0 comments on commit 8e113a7

Please sign in to comment.