Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct tipChanged subscription test
Browse files Browse the repository at this point in the history
moreal committed Sep 15, 2023
1 parent 0bdb7f9 commit b4c7d48
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -53,14 +53,15 @@ 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()!;

0 comments on commit b4c7d48

Please sign in to comment.