Skip to content

Commit

Permalink
Add TestL2GasPrice
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkushinDaniil committed Dec 22, 2024
1 parent 8e53328 commit bfeb90f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions starknet/block_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package starknet_test

import (
"testing"

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/juno/starknet"
"github.com/stretchr/testify/assert"
)

func TestL2GasPrice(t *testing.T) {
t.Run("L2GasPrice is not set", func(t *testing.T) {
block := starknet.Block{}
assert.Equal(t, &felt.Zero, block.L2GasPriceETH())
assert.Equal(t, &felt.Zero, block.L2GasPriceSTRK())
})

t.Run("L2GasPrice is set", func(t *testing.T) {
gasPriceWei := new(felt.Felt).SetUint64(100)
gasPriceFri := new(felt.Felt).SetUint64(50)
block := starknet.Block{
L2GasPrice: &starknet.GasPrice{
PriceInWei: gasPriceWei,
PriceInFri: gasPriceFri,
},
}
assert.Equal(t, gasPriceWei, block.L2GasPriceETH())
assert.Equal(t, gasPriceFri, block.L2GasPriceSTRK())
})
}

0 comments on commit bfeb90f

Please sign in to comment.