From 6fde9adf4b2fab256dabadd5a76ea0406447b882 Mon Sep 17 00:00:00 2001 From: Gregor Gololicic Date: Mon, 30 Oct 2023 19:33:14 +0100 Subject: [PATCH] add to other tests --- integration/tests/access/access_api_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/integration/tests/access/access_api_test.go b/integration/tests/access/access_api_test.go index 79b222c5dc5..c82fb34d09c 100644 --- a/integration/tests/access/access_api_test.go +++ b/integration/tests/access/access_api_test.go @@ -243,20 +243,25 @@ func (s *AccessAPISuite) testExecuteScriptWithSimpleContract(client *client.Clie script := lib.ReadCounterScript(serviceAccount.Address, serviceAccount.Address).ToCadence() s.Run("execute at latest block", func() { - result, err := client.ExecuteScriptAtLatestBlock(s.ctx, []byte(script), nil) + result, err := s.waitScriptExecutionUntilIndexed(func() (cadence.Value, error) { + return client.ExecuteScriptAtLatestBlock(s.ctx, []byte(script), nil) + }) s.Require().NoError(err) s.Assert().Equal(lib.CounterInitializedValue, result.(cadence.Int).Int()) }) s.Run("execute at block height", func() { - result, err := client.ExecuteScriptAtBlockHeight(s.ctx, header.Height, []byte(script), nil) + result, err := s.waitScriptExecutionUntilIndexed(func() (cadence.Value, error) { + return client.ExecuteScriptAtBlockHeight(s.ctx, header.Height, []byte(script), nil) + }) s.Require().NoError(err) - s.Assert().Equal(lib.CounterInitializedValue, result.(cadence.Int).Int()) }) s.Run("execute at block ID", func() { - result, err := client.ExecuteScriptAtBlockID(s.ctx, header.ID, []byte(script), nil) + result, err := s.waitScriptExecutionUntilIndexed(func() (cadence.Value, error) { + return client.ExecuteScriptAtBlockID(s.ctx, header.ID, []byte(script), nil) + }) s.Require().NoError(err) s.Assert().Equal(lib.CounterInitializedValue, result.(cadence.Int).Int()) })