-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* uncomment block id tests * move json as fixtures into own .json files * Remove bindings fixtures * Cleanup fixtures * Cleanup tests * Uncomment tests * Add TODO * python: basic block tagged data payload * python: it's a signed block * python: basic block transaction payload * python: validation block * nodejs: basic block tagged data payload * nodejs: basic block transaction payload * nodejs: validation block * simplify * nodejs: fix some block tests * remove temporary stuff * nits * back to interfaces * format * nit * cleanup * rename instead of serde rename * reverted u64 * update test vectors * attempt to fix tests * Update JSONs * Remove FIXMEs * Fix test * copyright Co-authored-by: Thoralf-M <[email protected]> * nodejs: re-enable validation block test * fix 1/3 python block id tests * allow passing args to pytest * Python: fix serialization/deserialization * linter, review * format * format (are you serious?) * lint tests * format annoying lints * assign id method for block * yarn lint * type field first * get rid of to_dict * update fixture * format * python: fix lint * python: fix metadata feature output tests * apply review suggestion Co-authored-by: Thoralf-M <[email protected]> * Nits --------- Co-authored-by: Thibault Martinez <[email protected]> Co-authored-by: Brord van Wierst <[email protected]> Co-authored-by: Thoralf-M <[email protected]> Co-authored-by: DaughterOfMars <[email protected]>
- Loading branch information
1 parent
1edc4f2
commit eb737eb
Showing
35 changed files
with
732 additions
and
844 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'reflect-metadata'; | ||
|
||
import { expect, describe, it } from '@jest/globals'; | ||
import * as basic_block_tagged_data_payload_json from '../../../../sdk/tests/types/fixtures/basic_block_tagged_data_payload.json'; | ||
import * as basic_block_transaction_payload_json from '../../../../sdk/tests/types/fixtures/basic_block_transaction_payload.json'; | ||
import * as validation_block_json from '../../../../sdk/tests/types/fixtures/validation_block.json'; | ||
import * as protocol_parameters_json from '../../../../sdk/tests/types/fixtures/protocol_parameters.json'; | ||
import { Block, BlockId, parseBlock, ProtocolParameters } from '../../'; | ||
|
||
describe('Block tests', () => { | ||
|
||
it('compares basic block tagged data payload from a fixture', async () => { | ||
const block = parseBlock(basic_block_tagged_data_payload_json.block); | ||
expect(block).toBeInstanceOf(Block); | ||
const params: ProtocolParameters = JSON.parse(JSON.stringify(protocol_parameters_json.params)); | ||
const expected_id = basic_block_tagged_data_payload_json.id as BlockId; | ||
expect(Block.id(block, params)).toEqual(expected_id); | ||
}); | ||
|
||
it('compares basic block transaction payload from a fixture', async () => { | ||
const block = parseBlock(basic_block_transaction_payload_json.block); | ||
expect(block).toBeInstanceOf(Block); | ||
const params: ProtocolParameters = JSON.parse(JSON.stringify(protocol_parameters_json.params)); | ||
const expected_id = basic_block_transaction_payload_json.id as BlockId; | ||
expect(Block.id(block, params)).toEqual(expected_id); | ||
}); | ||
|
||
it('compares validation block from a fixture', async () => { | ||
const block = parseBlock(validation_block_json.block); | ||
expect(block).toBeInstanceOf(Block); | ||
const params: ProtocolParameters = JSON.parse(JSON.stringify(protocol_parameters_json.params)); | ||
const expected_id = validation_block_json.id as BlockId; | ||
expect(Block.id(block, params)).toEqual(expected_id); | ||
}); | ||
}); |
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.