Skip to content

Commit

Permalink
fix: fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alienc0der committed Aug 1, 2023
1 parent 2818d70 commit 46d25e6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
4 changes: 2 additions & 2 deletions lib/src/model/nom/account_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class AccountBlock extends AccountBlockTemplate {
final data = super.toJson();
data['descendantBlocks'] =
descendantBlocks.map((block) => block.toJson()).toList();
data['usedPlasma'] = usedPlasma.toString();
data['basePlasma'] = basePlasma.toString();
data['usedPlasma'] = usedPlasma;
data['basePlasma'] = basePlasma;
data['changesHash'] = changesHash.toString();

data['token'] = token != null ? token!.toJson() : null;
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "67ec5684c7a19b2aba91d2831f3d305a6fd8e1504629c5818f8d64478abf4f38"
sha256: b9a384c4b9c4966dbf7215e7c033a78db1da7e5dcaf8da9232c5f24735f65652
url: "https://pub.dev"
source: hosted
version: "1.24.4"
version: "1.24.5"
test_api:
dependency: transitive
description:
Expand All @@ -421,10 +421,10 @@ packages:
dependency: transitive
description:
name: test_core
sha256: "6b753899253c38ca0523bb0eccff3934ec83d011705dae717c61ecf209e333c9"
sha256: c6a536288535efef8526eea8adfa4e25fdd2849fa7f457ecb2a52099998ce8f7
url: "https://pub.dev"
source: hosted
version: "0.5.4"
version: "0.5.5"
typed_data:
dependency: transitive
description:
Expand Down
11 changes: 7 additions & 4 deletions test/model/nom/account_block_template_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() async {
},
"address": "z1qzal6c5s9rjnnxd2z7dvdhjxpmmj4fmw56a0mz",
"toAddress": "z1qr4pexnnfaexqqz8nscjjcsajy5hdqfkgadvwx",
"amount": 10000000000,
"amount": "10000000000",
"tokenStandard": "zts1tfjkummwyppk76twsnv50e",
"fromBlockHash": "0000000000000000000000000000000000000000000000000000000000000000",
"data": "",
Expand All @@ -27,12 +27,15 @@ void main() async {
"publicKey": "GYyn77OXTL31zPbDBCe/eKir+VCF3hv+LxiOUF3XcJY=",
"signature": "hrQwfpdEYTjoLV9yzEppeky2Y/9T1x760vQPL6NLgD+cn0XD1+F/dOcSwyhg8RxjHWMN6MvD2NnTAX7N+5aCBQ=="
}''';
var accountBlockTemplate = AccountBlockTemplate.fromJson(jsonDecode(accountBlockTemplateString));
var accountBlockTemplate =
AccountBlockTemplate.fromJson(jsonDecode(accountBlockTemplateString));

test('same json', () {
expect(accountBlockTemplate.toJson(), jsonDecode(accountBlockTemplateString));
expect(
accountBlockTemplate.toJson(), jsonDecode(accountBlockTemplateString));
});
test('same hash', () {
expect(BlockUtils.getTransactionHash(accountBlockTemplate).toString(), '3835082b4afb76971d58d6ad510e7e91f3bb0d41912fac4ec4cfef7bd7bbea73');
expect(BlockUtils.getTransactionHash(accountBlockTemplate).toString(),
'3835082b4afb76971d58d6ad510e7e91f3bb0d41912fac4ec4cfef7bd7bbea73');
});
}
22 changes: 12 additions & 10 deletions test/model/nom/account_block_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() async {
},
"address": "z1qzal6c5s9rjnnxd2z7dvdhjxpmmj4fmw56a0mz",
"toAddress": "z1qr4pexnnfaexqqz8nscjjcsajy5hdqfkgadvwx",
"amount": 10000000000,
"amount": "10000000000",
"tokenStandard": "zts1tfjkummwyppk76twsnv50e",
"fromBlockHash": "0000000000000000000000000000000000000000000000000000000000000000",
"descendantBlocks": [],
Expand All @@ -34,11 +34,11 @@ void main() async {
"name": "Zenon Coin",
"symbol": "ZNN",
"domain": "zenon.network",
"totalSupply": 19500000000000,
"totalSupply": "19500000000000",
"decimals": 8,
"owner": "z1qxemdeddedxpyllarxxxxxxxxxxxxxxxsy3fmg",
"tokenStandard": "zts1tfjkummwyppk76twsnv50e",
"maxSupply": 4611686018427387903,
"maxSupply": "4611686018427387903",
"isBurnable": true,
"isMintable": true,
"isUtility": true
Expand All @@ -62,7 +62,7 @@ void main() async {
},
"address": "z1qr4pexnnfaexqqz8nscjjcsajy5hdqfkgadvwx",
"toAddress": "z1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsggv2f",
"amount": 0,
"amount": "0",
"tokenStandard": "zts1qqqqqqqqqqqqqqqqtq587y",
"fromBlockHash": "3835082b4afb76971d58d6ad510e7e91f3bb0d41912fac4ec4cfef7bd7bbea73",
"descendantBlocks": [],
Expand Down Expand Up @@ -99,7 +99,7 @@ void main() async {
},
"address": "z1qr4pexnnfaexqqz8nscjjcsajy5hdqfkgadvwx",
"toAddress": "z1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsggv2f",
"amount": 0,
"amount": "0",
"tokenStandard": "zts1qqqqqqqqqqqqqqqqtq587y",
"fromBlockHash": "3835082b4afb76971d58d6ad510e7e91f3bb0d41912fac4ec4cfef7bd7bbea73",
"descendantBlocks": [],
Expand Down Expand Up @@ -132,7 +132,7 @@ void main() async {
},
"address": "z1qzal6c5s9rjnnxd2z7dvdhjxpmmj4fmw56a0mz",
"toAddress": "z1qr4pexnnfaexqqz8nscjjcsajy5hdqfkgadvwx",
"amount": 10000000000,
"amount": "10000000000",
"tokenStandard": "zts1tfjkummwyppk76twsnv50e",
"fromBlockHash": "0000000000000000000000000000000000000000000000000000000000000000",
"descendantBlocks": [],
Expand All @@ -149,11 +149,11 @@ void main() async {
"name": "Zenon Coin",
"symbol": "ZNN",
"domain": "zenon.network",
"totalSupply": 19500000000000,
"totalSupply": "19500000000000",
"decimals": 8,
"owner": "z1qxemdeddedxpyllarxxxxxxxxxxxxxxxsy3fmg",
"tokenStandard": "zts1tfjkummwyppk76twsnv50e",
"maxSupply": 4611686018427387903,
"maxSupply": "4611686018427387903",
"isBurnable": true,
"isMintable": true,
"isUtility": true
Expand All @@ -168,7 +168,8 @@ void main() async {
}
}''';

var sendAccountBlock = AccountBlock.fromJson(jsonDecode(sendAccountBlockString));
var sendAccountBlock =
AccountBlock.fromJson(jsonDecode(sendAccountBlockString));
test('same send json', () {
expect(sendAccountBlock.toJson(), jsonDecode(sendAccountBlockString));
});
Expand All @@ -177,7 +178,8 @@ void main() async {
'3835082b4afb76971d58d6ad510e7e91f3bb0d41912fac4ec4cfef7bd7bbea73');
});

var receiveAccountBlock = AccountBlock.fromJson(jsonDecode(receiveAccountBlockString));
var receiveAccountBlock =
AccountBlock.fromJson(jsonDecode(receiveAccountBlockString));
test('same receive json', () {
expect(receiveAccountBlock.toJson(), jsonDecode(receiveAccountBlockString));
});
Expand Down

0 comments on commit 46d25e6

Please sign in to comment.