Skip to content

Commit

Permalink
tests tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
deemru committed Aug 15, 2024
1 parent 29f8c86 commit 5301be7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/NodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,17 @@ function testNode(): void
$block = $nodeW->getLastBlock();
$blocks = $nodeW->getBlocksGeneratedBy( $block->generator(), $heightW - 10, $heightW );

$blocks = $nodeW->getBlocks( $heightW - 4, $heightW );
try
{
$blocks = $nodeW->getBlocks( $heightW - 4, $heightW );
}
catch( Exception $e )
{
if( false !== strpos( $e->getMessage(), 'HTTP 429' ) )
sleep( 5 );
$blocks = $nodeW->getBlocks( $heightW - 4, $heightW );
}

$this->assertSame( 5, count( $blocks ) );
foreach( $blocks as $block )
foreach( $block->transactions() as $tx )
Expand Down Expand Up @@ -411,7 +421,7 @@ function testExceptions(): void
$json = $node->get( '/blocks/headers/last' );

$this->catchExceptionOrFail( ExceptionCode::FETCH_URI, function() use ( $node ){ $node->get( '/test' ); } );
$this->catchExceptionOrFail( ExceptionCode::JSON_DECODE, function() use ( $node ){ $node->get( '/api-docs/favicon-16x16.png' ); } );
$this->catchExceptionOrFail( ExceptionCode::JSON_DECODE, function() use ( $node ){ $node->get( '/api-docs/index.css' ); } );
$this->catchExceptionOrFail( ExceptionCode::KEY_MISSING, function() use ( $json ){ $json->get( 'x' ); } );
$this->catchExceptionOrFail( ExceptionCode::INT_EXPECTED, function() use ( $json ){ $json->get( 'signature' )->asInt(); } );
$this->catchExceptionOrFail( ExceptionCode::STRING_EXPECTED, function() use ( $json ){ $json->get( 'height' )->asString(); } );
Expand Down

0 comments on commit 5301be7

Please sign in to comment.