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

     1  //go:build all || unit
     2  // +build all unit
     3  
     4  package hedera
     5  
     6  /*-
     7   *
     8   * Hedera Go SDK
     9   *
    10   * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC
    11   *
    12   * Licensed under the Apache License, Version 2.0 (the "License");
    13   * you may not use this file except in compliance with the License.
    14   * You may obtain a copy of the License at
    15   *
    16   *      http://www.apache.org/licenses/LICENSE-2.0
    17   *
    18   * Unless required by applicable law or agreed to in writing, software
    19   * distributed under the License is distributed on an "AS IS" BASIS,
    20   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    21   * See the License for the specific language governing permissions and
    22   * limitations under the License.
    23   *
    24   */
    25  
    26  import (
    27  	"os"
    28  	"testing"
    29  
    30  	"github.com/stretchr/testify/assert"
    31  	"github.com/stretchr/testify/require"
    32  )
    33  
    34  func TestUnitFeeSchedulesFromBytes(t *testing.T) {
    35  	t.Parallel()
    36  	// nolint
    37  	dat, err := os.ReadFile("./fee_schedule/fee_schedule.pb")
    38  	require.NoError(t, err)
    39  	feeSchedules, err := FeeSchedulesFromBytes(dat)
    40  	require.NoError(t, err)
    41  	assert.NotNil(t, feeSchedules)
    42  	assert.Equal(t, int64(11461413665), feeSchedules.current.TransactionFeeSchedules[0].Fees[0].NodeData.Constant)
    43  	assert.Equal(t, int64(229228273302), feeSchedules.current.TransactionFeeSchedules[0].Fees[0].ServiceData.Constant)
    44  	assert.Equal(t, feeSchedules.current.TransactionFeeSchedules[0].RequestType, RequestTypeCryptoCreate)
    45  }