Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced some for loops with some Map from juno/utils #467

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 35 additions & 18 deletions account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ var (
// Parameters:
// - m: is the test main
// Returns:
// none
//
// none
func TestMain(m *testing.M) {
flag.StringVar(&testEnv, "env", "mock", "set the test environment")
flag.Parse()
Expand All @@ -60,11 +61,13 @@ func TestMain(m *testing.M) {
// of the transaction hash. Each test case consists of the expected hash, a flag
// indicating whether the KeyStore should be set, account address, public key,
// private key, chain ID, function call, and transaction details.
//
//
// Parameters:
// - t: The testing.T object for running the test
//
// Returns:
// none
//
// none
func TestTransactionHashInvoke(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
Expand Down Expand Up @@ -184,11 +187,12 @@ func TestTransactionHashInvoke(t *testing.T) {
//
// It tests the FmtCallData function by providing different test sets
// and comparing the output with the expected call data.
//
//
// Parameters:
// - t: The testing.T instance for running the test
// Return:
// none
//
// none
func TestFmtCallData(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
Expand Down Expand Up @@ -253,7 +257,8 @@ func TestFmtCallData(t *testing.T) {
// Parameters:
// - t: The testing.T instance for running the test
// Return:
// none
//
// none
func TestChainIdMOCK(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
Expand Down Expand Up @@ -296,7 +301,8 @@ func TestChainIdMOCK(t *testing.T) {
// Parameters:
// - t: The testing.T instance for running the test
// Return:
// none
//
// none
func TestChainId(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
Expand Down Expand Up @@ -344,7 +350,8 @@ func TestChainId(t *testing.T) {
// Parameters:
// - t: The testing.T instance for running the test
// Returns:
// none
//
// none
func TestSignMOCK(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
Expand Down Expand Up @@ -404,7 +411,8 @@ func TestSignMOCK(t *testing.T) {
// Parameters:
// - t: The testing.T instance for running the test
// Returns:
// none
//
// none
func TestAddInvoke(t *testing.T) {

type testSetType struct {
Expand Down Expand Up @@ -582,9 +590,11 @@ func TestAddInvoke(t *testing.T) {
// response is not nil.
//
// Parameters:
// - t: is the testing framework
// - t: is the testing framework
//
// Returns:
// none
//
// none
func TestAddDeployAccountDevnet(t *testing.T) {
if testEnv != "devnet" {
t.Skip("Skipping test as it requires a devnet environment")
Expand Down Expand Up @@ -640,9 +650,11 @@ func TestAddDeployAccountDevnet(t *testing.T) {
// Finally, it verifies that the calculated hash matches the expected hash.
//
// Parameters:
// - t: is the testing framework
// - t: is the testing framework
//
// Returns:
// none
//
// none
func TestTransactionHashDeployAccountTestnet(t *testing.T) {

if testEnv != "testnet" {
Expand Down Expand Up @@ -709,7 +721,8 @@ func TestTransactionHashDeployAccountTestnet(t *testing.T) {
// Parameters:
// - t: reference to the testing.T object
// Returns:
// none
//
// none
func TestTransactionHashDeclare(t *testing.T) {
// https://goerli.voyager.online/tx/0x4e0519272438a3ae0d0fca776136e2bb6fcd5d3b2af47e53575c5874ccfce92
if testEnv != "testnet" {
Expand Down Expand Up @@ -751,7 +764,8 @@ func TestTransactionHashDeclare(t *testing.T) {
// Parameters:
// - t: The testing.T object for test assertions and logging
// Returns:
// none
//
// none
func TestWaitForTransactionReceiptMOCK(t *testing.T) {
mockCtrl := gomock.NewController(t)
t.Cleanup(mockCtrl.Finish)
Expand Down Expand Up @@ -833,7 +847,8 @@ func TestWaitForTransactionReceiptMOCK(t *testing.T) {
// Parameters:
// - t: The testing.T instance for running the test
// Returns:
// none
//
// none
func TestWaitForTransactionReceipt(t *testing.T) {
if testEnv != "devnet" {
t.Skip("Skipping test as it requires a devnet environment")
Expand Down Expand Up @@ -882,9 +897,11 @@ func TestWaitForTransactionReceipt(t *testing.T) {
// It asserts that the expected hash and error values are returned for each test set.
//
// Parameters:
// - t: The testing.T instance for running the test
// - t: The testing.T instance for running the test
//
// Returns:
// none
//
// none
func TestAddDeclareTxn(t *testing.T) {
// https://goerli.voyager.online/tx/0x76af2faec46130ffad1ab2f615ad16b30afcf49cfbd09f655a26e545b03a21d
if testEnv != "testnet" {
Expand Down
47 changes: 38 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,69 @@ module github.com/NethermindEth/starknet.go
go 1.21

require (
github.com/NethermindEth/juno v0.3.1
github.com/ethereum/go-ethereum v1.10.26
github.com/NethermindEth/juno v0.7.4
github.com/ethereum/go-ethereum v1.12.0
github.com/golang/mock v1.6.0
github.com/joho/godotenv v1.4.0
github.com/nsf/jsondiff v0.0.0-20210926074059-1e845ec5d249
github.com/pkg/errors v0.9.1
github.com/test-go/testify v1.1.4
golang.org/x/crypto v0.2.0
golang.org/x/crypto v0.14.0
)

require (
github.com/DataDog/zstd v1.5.5 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.11.0 // indirect
github.com/consensys/gnark-crypto v0.12.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/getsentry/sentry-go v0.24.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/libp2p/go-libp2p v0.31.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

require (
github.com/google/go-cmp v0.5.7
golang.org/x/sys v0.3.0 // indirect
github.com/google/go-cmp v0.5.9
golang.org/x/sys v0.13.0 // indirect
)
Loading