From 24c942423fb6a491a27b4bae96519585221b0b68 Mon Sep 17 00:00:00 2001 From: moreal Date: Fri, 15 Sep 2023 13:08:12 +0900 Subject: [PATCH] Correct tipChanged subscription test --- .../GraphTypes/StandaloneSubscriptionTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NineChronicles.Headless.Tests/GraphTypes/StandaloneSubscriptionTest.cs b/NineChronicles.Headless.Tests/GraphTypes/StandaloneSubscriptionTest.cs index 76f309a1f..b45aa9f5a 100644 --- a/NineChronicles.Headless.Tests/GraphTypes/StandaloneSubscriptionTest.cs +++ b/NineChronicles.Headless.Tests/GraphTypes/StandaloneSubscriptionTest.cs @@ -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)((ExecutionNode) result.Data!).ToValue()!; + + Assert.Equal(index, BlockChain.Tip.Index); + var result = await ExecuteSubscriptionQueryAsync("subscription { tipChanged { index hash } }"); Assert.IsType(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)((ExecutionNode)rawEvents.Data!).ToValue()!;