-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: _fromProtobuf functions where google primitive wrappers used (#2657
) * feat: add unit tests for optional properties when deserializing NodeUpdateTransaction Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: NodeUpdateTransaction _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: AccountUpdateTransaction _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: ContractFunctionResult _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: TokenTransfer _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: ContractUpdateTransaction _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: FileUpdateTransaction _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: TokenUpdateTransaction _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: TopicUpdateTransaction _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: TokenUpdateTransaction fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: TokenUpdateNftsTransaction _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> * fix: ContractFunctionResult _fromProtobuf Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech> --------- Signed-off-by: Svetoslav Borislavov <svetoslav.borislavov@limechain.tech>
- Loading branch information
1 parent
155bbc1
commit e7ad84a
Showing
17 changed files
with
194 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { AccountUpdateTransaction } from "../../src/index.js"; | ||
|
||
describe("AccountUpdateTransaction", function () { | ||
describe("deserialization of optional parameters", function () { | ||
let tx, txBytes, tx2; | ||
|
||
before(function () { | ||
tx = new AccountUpdateTransaction(); | ||
txBytes = tx.toBytes(); | ||
tx2 = AccountUpdateTransaction.fromBytes(txBytes); | ||
}); | ||
|
||
it("should deserialize with accountMemo being null", function () { | ||
expect(tx.accountMemo).to.be.null; | ||
expect(tx2.accountMemo).to.be.null; | ||
}); | ||
|
||
it("should deserialize with declineReward, receiverSignatureRequired being null", function () { | ||
expect(tx.declineStakingRewards).to.be.null; | ||
expect(tx2.declineStakingRewards).to.be.null; | ||
|
||
expect(tx.receiverSignatureRequired).to.be.null; | ||
expect(tx2.receiverSignatureRequired).to.be.null; | ||
}); | ||
|
||
it("should deserialize with maxAutomaticTokenAssociations being null", function () { | ||
expect(tx.maxAutomaticTokenAssociations).to.be.null; | ||
expect(tx2.maxAutomaticTokenAssociations).to.be.null; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ContractUpdateTransaction } from "../../src/index.js"; | ||
|
||
describe("ContractUpdateTransaction", function () { | ||
describe("deserialization of optional parameters", function () { | ||
it("should deserialize with contractMemo being null", function () { | ||
const tx = new ContractUpdateTransaction(); | ||
const tx2 = ContractUpdateTransaction.fromBytes(tx.toBytes()); | ||
|
||
expect(tx.contractMemo).to.be.null; | ||
expect(tx2.contractMemo).to.be.null; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { FileUpdateTransaction } from "../../src/index.js"; | ||
|
||
describe("FileUpdateTransaction", function () { | ||
describe("deserialization of optional parameters", function () { | ||
it("should deserialize with fileMemo being null", function () { | ||
const tx = new FileUpdateTransaction(); | ||
const tx2 = FileUpdateTransaction.fromBytes(tx.toBytes()); | ||
|
||
expect(tx.fileMemo).to.be.null; | ||
expect(tx2.fileMemo).to.be.null; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import TokenTransfer from "../../src/token/TokenTransfer.js"; | ||
|
||
describe("TokenTransfer", function () { | ||
describe("_fromProtobuf with optional parameters", function () { | ||
it("should deserialize with expectedDecimals being null", function () { | ||
const transfer = new TokenTransfer({ | ||
tokenId: "0.0.123", | ||
accountId: "0.0.456", | ||
amount: 100, | ||
expectedDecimals: null, | ||
isApproved: true, | ||
}); | ||
|
||
const transfersProtobuf = [ | ||
{ | ||
token: transfer.tokenId._toProtobuf(), | ||
expectedDecimals: {}, | ||
transfers: [transfer._toProtobuf()], | ||
}, | ||
]; | ||
|
||
const [transferFromProtobuf] = | ||
TokenTransfer._fromProtobuf(transfersProtobuf); | ||
|
||
expect(transferFromProtobuf.expectedDecimals).to.be.null; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.