Skip to content

Commit

Permalink
Correct tipChanged subscription test
Browse files Browse the repository at this point in the history
  • Loading branch information
moreal committed Sep 15, 2023
1 parent 0bdb7f9 commit 92011e8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public async Task SubscribeTipChangedEvent()
lastCommit: GenerateBlockCommit(BlockChain.Tip.Index, BlockChain.Tip.Hash, GenesisValidators));
BlockChain.Append(block, GenerateBlockCommit(block.Index, block.Hash, GenesisValidators));

var result = await ExecuteSubscriptionQueryAsync("subscription { tipChanged { index hash } }");

// var data = (Dictionary<string, object>)((ExecutionNode) result.Data!).ToValue()!;

Assert.Equal(index, BlockChain.Tip.Index);
var result = await ExecuteSubscriptionQueryAsync("subscription { tipChanged { index hash } }");
Assert.IsType<SubscriptionExecutionResult>(result);
var subscribeResult = (SubscriptionExecutionResult)result;
Assert.Equal(index, BlockChain.Tip.Index);
var stream = subscribeResult.Streams!.Values.FirstOrDefault();
var rawEvents = await stream.Take((int)index);
var rawEvents = await stream.Take(1);
Assert.NotNull(rawEvents);

var events = (Dictionary<string, object>)((ExecutionNode)rawEvents.Data!).ToValue()!;
Expand Down

0 comments on commit 92011e8

Please sign in to comment.