Skip to content

Commit

Permalink
PR to remove deprecated API from v0 (#81)
Browse files Browse the repository at this point in the history
* removed obvious things and fixed tests

* remove more deprecations

* fixed index change

* fixed more coverage
  • Loading branch information
bjartek authored Jan 4, 2023
1 parent e0afdf9 commit b59c2ea
Show file tree
Hide file tree
Showing 29 changed files with 489 additions and 3,166 deletions.
24 changes: 13 additions & 11 deletions account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ func TestErrorsInAccountCreation(t *testing.T) {
})

t.Run("Should give error on wrong contract name", func(t *testing.T) {
assert.Panics(t, func() {
NewTestingEmulator().Config("testdata/non_existing_contract.json").Start()
})
_, err := OverflowTesting(WithFlowConfig("testdata/non_existing_contract.json"))
assert.ErrorContains(t, err, "deployment contains nonexisting contract Debug2")
})

t.Run("Should give error on invalid env var in flow.json", func(t *testing.T) {
_, err := NewTestingEmulator().Config("testdata/invalid_env_flow.json").StartE()
_, err := OverflowTesting(WithFlowConfig("testdata/invalid_env_flow.json"))
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid private key for account: emulator-5")
})

t.Run("Should give error on wrong account name", func(t *testing.T) {
_, err := NewTestingEmulator().Config("testdata/invalid_account_in_deployment.json").StartE()
_, err := OverflowTesting(WithFlowConfig("testdata/invalid_account_in_deployment.json"))
require.Error(t, err)
assert.Contains(t, err.Error(), "deployment contains nonexisting account emulator-firs")
})
Expand All @@ -39,7 +38,7 @@ func TestErrorsInAccountCreation(t *testing.T) {
func TestGetAccount(t *testing.T) {

t.Run("Should return the account", func(t *testing.T) {
g, err := NewTestingEmulator().StartE()
g, err := OverflowTesting()
require.NoError(t, err)
account, err := g.GetAccount("account")

Expand All @@ -48,15 +47,15 @@ func TestGetAccount(t *testing.T) {
})

t.Run("Should return an error if account doesn't exist", func(t *testing.T) {
g, err := NewTestingEmulator().StartE()
g, err := OverflowTesting()
require.NoError(t, err)
_, err = g.GetAccount("doesnotexist")
assert.ErrorContains(t, err, "could not find account with name emulator-doesnotexist in the configuration")

})

t.Run("Should return an error if sa does not exist", func(t *testing.T) {
_, err := NewTestingEmulator().SetServiceSuffix("dummy").StartE()
_, err := OverflowTesting(WithServiceAccountSuffix("dummy"))

assert.ErrorContains(t, err, "could not find account with name emulator-dummy in the configuration")

Expand All @@ -67,15 +66,18 @@ func TestGetAccount(t *testing.T) {
func TestCheckContractUpdate(t *testing.T) {

t.Run("Should return the updatable contracts", func(t *testing.T) {
g, _ := NewTestingEmulator().StartE()

g, err := OverflowTesting()
require.NoError(t, err)
res, err := g.CheckContractUpdates()

assert.Nil(t, err)
autogold.Equal(t, res)
})

t.Run("Should return the updatable contracts (updatable)", func(t *testing.T) {
g, _ := NewTestingEmulator().StartE()
g, err := OverflowTesting()
require.NoError(t, err)

code := []byte(`pub contract Debug{
Expand Down Expand Up @@ -128,7 +130,7 @@ func TestCheckContractUpdate(t *testing.T) {
Network: "emulator",
}

err := g.AddContract("account", contract, true)
err = g.AddContract("account", contract, true)
assert.Nil(t, err)
res, err := g.CheckContractUpdates()

Expand Down
Loading

0 comments on commit b59c2ea

Please sign in to comment.