Skip to content

Commit

Permalink
fix tests pkg and rename to devnet (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Oct 5, 2023
1 parent 4872486 commit 545e2fc
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 39 deletions.
6 changes: 3 additions & 3 deletions account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (

"github.com/NethermindEth/starknet.go/account"
"github.com/NethermindEth/starknet.go/contracts"
"github.com/NethermindEth/starknet.go/devnet"
"github.com/NethermindEth/starknet.go/hash"
"github.com/NethermindEth/starknet.go/mocks"
"github.com/NethermindEth/starknet.go/rpc"
"github.com/NethermindEth/starknet.go/test"
"github.com/NethermindEth/starknet.go/utils"
"github.com/golang/mock/gomock"
"github.com/test-go/testify/require"
Expand Down Expand Up @@ -709,8 +709,8 @@ func TestAddDeclareTxn(t *testing.T) {
}
}

func newDevnet(t *testing.T, url string) ([]test.TestAccount, error) {
devnet := test.NewDevNet(url)
func newDevnet(t *testing.T, url string) ([]devnet.TestAccount, error) {
devnet := devnet.NewDevNet(url)
acnts, err := devnet.Accounts()
return acnts, err
}
3 changes: 1 addition & 2 deletions test/devnet.go → devnet/devnet.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test
package devnet

import (
"bytes"
Expand Down Expand Up @@ -41,7 +41,6 @@ func (devnet *DevNet) api(uri string) string {
func (devnet *DevNet) Accounts() ([]TestAccount, error) {
req, err := http.NewRequest(http.MethodGet, devnet.api("/predeployed_accounts"), nil)
if err != nil {

return nil, err
}
client := &http.Client{}
Expand Down
2 changes: 1 addition & 1 deletion test/devnet_test.go → devnet/devnet_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test
package devnet

import (
"math/big"
Expand Down
28 changes: 28 additions & 0 deletions devnet/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package devnet

import (
"flag"
"os"
"testing"
)

const (
DevNetETHAddress = "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
)

// testConfiguration is a type that is used to configure tests
type testConfiguration struct {
base string
}

var (
// set the environment for the test, default: devnet
testEnv = "devnet"
)

// TestMain is used to trigger the tests and, in that case, check for the environment to use.
func TestMain(m *testing.M) {
flag.StringVar(&testEnv, "env", "devnet", "set the test environment")
flag.Parse()
os.Exit(m.Run())
}
33 changes: 0 additions & 33 deletions test/main_test.go

This file was deleted.

0 comments on commit 545e2fc

Please sign in to comment.