Skip to content

Commit

Permalink
Enable storage limit for emulator backend
Browse files Browse the repository at this point in the history
This will make the testing environment behave more similar to
a development/testnet environment.
  • Loading branch information
m-Peter committed Jan 8, 2024
1 parent 0507d59 commit 14f69ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion test/emulator_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ func newBlockchain(
b, err := emulator.New(
append(
[]emulator.Option{
emulator.WithStorageLimitEnabled(false),
emulator.WithStorageLimitEnabled(true),
emulator.WithServerLogger(logger),
emulator.Contracts(commonContracts),
emulator.WithChainID(chain.ChainID()),
Expand Down
30 changes: 15 additions & 15 deletions test/test_framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ func TestImportContract(t *testing.T) {
Test.assert(blockHeight > 1)
mintFlow(to: admin, amount: 500.0)
Test.assertEqual(500.0, getFlowBalance(account: admin))
Test.assertEqual(500.001, getFlowBalance(account: admin))
let lowestHeight = RandomBeaconHistory.getLowestHeight()
Test.assertEqual(UInt64(1), lowestHeight)
Expand Down Expand Up @@ -1155,7 +1155,7 @@ func TestUsingEnv(t *testing.T) {
access(all)
fun test() {
let acc = getAccount(0x10)
Test.assertEqual(0.0, acc.balance)
Test.assertEqual(0.001, acc.balance)
}
`

Expand Down Expand Up @@ -1186,7 +1186,7 @@ func TestUsingEnv(t *testing.T) {
access(all)
fun test() {
Test.assertEqual(0.0, FooContract.getBalance())
Test.assertEqual(0.001, FooContract.getBalance())
}
`

Expand Down Expand Up @@ -3602,7 +3602,7 @@ func TestGetAccountFlowBalance(t *testing.T) {
let balance = getFlowBalance(account: account)
// Assert
Test.assertEqual(1000000000.0, balance)
Test.assertEqual(999999999.977, balance)
}
`

Expand Down Expand Up @@ -3661,7 +3661,7 @@ func TestMintFlow(t *testing.T) {
// Assert
let balance = getFlowBalance(account: account)
Test.assertEqual(1500.0, balance)
Test.assertEqual(1500.001, balance)
}
`

Expand Down Expand Up @@ -3689,14 +3689,14 @@ func TestBurnFlow(t *testing.T) {
// Assert
var balance = getFlowBalance(account: account)
Test.assertEqual(1500.0, balance)
Test.assertEqual(1500.001, balance)
// Act
burnFlow(from: account, amount: 500.0)
// Assert
balance = getFlowBalance(account: account)
Test.assertEqual(1000.0, balance)
Test.assertEqual(1000.001, balance)
}
`

Expand Down Expand Up @@ -3852,7 +3852,7 @@ func TestServiceAccount(t *testing.T) {
let balance = getFlowBalance(account: account)
// Assert
Test.assertEqual(1000000000.0, balance)
Test.assertEqual(999999999.977, balance)
}
access(all)
Expand All @@ -3875,7 +3875,7 @@ func TestServiceAccount(t *testing.T) {
// Assert
let balance = getFlowBalance(account: receiver)
Test.assertEqual(1500.0, balance)
Test.assertEqual(1500.001, balance)
}
`

Expand Down Expand Up @@ -5077,22 +5077,22 @@ func TestBlockchainReset(t *testing.T) {
// Arrange
let account = Test.createAccount()
var balance = getFlowBalance(account: account)
Test.assertEqual(0.0, balance)
Test.assertEqual(0.001, balance)
let height = getCurrentBlockHeight()
mintFlow(to: account, amount: 1500.0)
balance = getFlowBalance(account: account)
Test.assertEqual(1500.0, balance)
Test.assertEqual(1500.001, balance)
Test.assertEqual(getCurrentBlockHeight(), height + 1)
// Act
Test.reset(to: height)
// Assert
balance = getFlowBalance(account: account)
Test.assertEqual(0.0, balance)
Test.assertEqual(0.001, balance)
Test.assertEqual(getCurrentBlockHeight(), height)
}
`
Expand Down Expand Up @@ -5597,17 +5597,17 @@ func TestEmulatorBlockchainSnapshotting(t *testing.T) {
Test.createSnapshot(name: "adminFunded")
var balance = getFlowBalance(account: admin)
Test.assertEqual(1000.0, balance)
Test.assertEqual(1000.001, balance)
Test.loadSnapshot(name: "adminCreated")
balance = getFlowBalance(account: admin)
Test.assertEqual(0.0, balance)
Test.assertEqual(0.001, balance)
Test.loadSnapshot(name: "adminFunded")
balance = getFlowBalance(account: admin)
Test.assertEqual(1000.0, balance)
Test.assertEqual(1000.001, balance)
}
`

Expand Down

0 comments on commit 14f69ba

Please sign in to comment.