github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/address_book_query_unit_test.go (about)

     1  //go:build all || unit
     2  // +build all unit
     3  
     4  package hedera
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  /*-
    13   *
    14   * Hedera Go SDK
    15   *
    16   * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC
    17   *
    18   * Licensed under the Apache License, Version 2.0 (the "License");
    19   * you may not use this file except in compliance with the License.
    20   * You may obtain a copy of the License at
    21   *
    22   *      http://www.apache.org/licenses/LICENSE-2.0
    23   *
    24   * Unless required by applicable law or agreed to in writing, software
    25   * distributed under the License is distributed on an "AS IS" BASIS,
    26   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    27   * See the License for the specific language governing permissions and
    28   * limitations under the License.
    29   *
    30   */
    31  
    32  func TestUnitAddressBookQueryCoverage(t *testing.T) {
    33  	t.Parallel()
    34  
    35  	checksum := "dmqui"
    36  	file := FileID{File: 3, checksum: &checksum}
    37  
    38  	client, err := _NewMockClient()
    39  	client.SetLedgerID(*NewLedgerIDTestnet())
    40  	require.NoError(t, err)
    41  	client.SetAutoValidateChecksums(true)
    42  
    43  	query := NewAddressBookQuery().
    44  		SetFileID(file).
    45  		SetLimit(3).
    46  		SetMaxAttempts(4)
    47  
    48  	err = query.validateNetworkOnIDs(client)
    49  
    50  	require.NoError(t, err)
    51  	query.GetFileID()
    52  	query.GetLimit()
    53  	query.GetFileID()
    54  }