Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanTinianov committed Mar 7, 2024
1 parent 4ea80fd commit 80186d0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions core/cmd/evm_transaction_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestShell_IndexTransactions(t *testing.T) {

_, from := cltest.MustInsertRandomKey(t, app.KeyStore.Eth())

txStore := cltest.NewTestTxStore(t, app.GetSqlxDB(), app.GetConfig().Database())
txStore := cltest.NewTestTxStore(t, app.GetSqlxDB())
tx := cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, 0, 1, from)
attempt := tx.TxAttempts[0]

Expand Down Expand Up @@ -73,7 +73,7 @@ func TestShell_ShowTransaction(t *testing.T) {
db := app.GetSqlxDB()
_, from := cltest.MustInsertRandomKey(t, app.KeyStore.Eth())

txStore := cltest.NewTestTxStore(t, db, app.GetConfig().Database())
txStore := cltest.NewTestTxStore(t, db)
tx := cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, 0, 1, from)
attempt := tx.TxAttempts[0]

Expand All @@ -97,7 +97,7 @@ func TestShell_IndexTxAttempts(t *testing.T) {

_, from := cltest.MustInsertRandomKey(t, app.KeyStore.Eth())

txStore := cltest.NewTestTxStore(t, app.GetSqlxDB(), app.GetConfig().Database())
txStore := cltest.NewTestTxStore(t, app.GetSqlxDB())
tx := cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, 0, 1, from)

// page 1
Expand Down
4 changes: 2 additions & 2 deletions core/cmd/shell_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func TestShell_RebroadcastTransactions_Txm(t *testing.T) {
keyStore := cltest.NewKeyStore(t, sqlxDB, config.Database())
_, fromAddress := cltest.MustInsertRandomKey(t, keyStore.Eth())

txStore := cltest.NewTestTxStore(t, sqlxDB, config.Database())
txStore := cltest.NewTestTxStore(t, sqlxDB)
cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, 7, 42, fromAddress)

lggr := logger.TestLogger(t)
Expand Down Expand Up @@ -372,7 +372,7 @@ func TestShell_RebroadcastTransactions_OutsideRange_Txm(t *testing.T) {

_, fromAddress := cltest.MustInsertRandomKey(t, keyStore.Eth())

txStore := cltest.NewTestTxStore(t, sqlxDB, config.Database())
txStore := cltest.NewTestTxStore(t, sqlxDB)
cltest.MustInsertConfirmedEthTxWithLegacyAttempt(t, txStore, int64(test.nonce), 42, fromAddress)

lggr := logger.TestLogger(t)
Expand Down
11 changes: 6 additions & 5 deletions core/web/evm_transactions_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ func TestTransactionsController_Index_Success(t *testing.T) {

app := cltest.NewApplicationWithKey(t)
require.NoError(t, app.Start(testutils.Context(t)))
ctx := testutils.Context(t)

db := app.GetSqlxDB()
txStore := cltest.NewTestTxStore(t, app.GetSqlxDB(), app.GetConfig().Database())
txStore := cltest.NewTestTxStore(t, app.GetSqlxDB())
ethKeyStore := cltest.NewKeyStore(t, db, app.Config.Database()).Eth()
client := app.NewHTTPClient(nil)
_, from := cltest.MustInsertRandomKey(t, ethKeyStore)
Expand All @@ -40,9 +41,9 @@ func TestTransactionsController_Index_Success(t *testing.T) {
attempt.State = txmgrtypes.TxAttemptBroadcast
attempt.TxFee = gas.EvmFee{Legacy: assets.NewWeiI(3)}
attempt.BroadcastBeforeBlockNum = &blockNum
require.NoError(t, txStore.InsertTxAttempt(&attempt))
require.NoError(t, txStore.InsertTxAttempt(ctx, &attempt))

_, count, err := txStore.TransactionsWithAttempts(0, 100)
_, count, err := txStore.TransactionsWithAttempts(ctx, 0, 100)
require.NoError(t, err)
require.Equal(t, count, 3)

Expand Down Expand Up @@ -81,7 +82,7 @@ func TestTransactionsController_Show_Success(t *testing.T) {
app := cltest.NewApplicationWithKey(t)
require.NoError(t, app.Start(testutils.Context(t)))

txStore := cltest.NewTestTxStore(t, app.GetSqlxDB(), app.GetConfig().Database())
txStore := cltest.NewTestTxStore(t, app.GetSqlxDB())
client := app.NewHTTPClient(nil)
_, from := cltest.MustInsertRandomKey(t, app.KeyStore.Eth())

Expand Down Expand Up @@ -114,7 +115,7 @@ func TestTransactionsController_Show_NotFound(t *testing.T) {
app := cltest.NewApplicationWithKey(t)
require.NoError(t, app.Start(testutils.Context(t)))

txStore := cltest.NewTestTxStore(t, app.GetSqlxDB(), app.GetConfig().Database())
txStore := cltest.NewTestTxStore(t, app.GetSqlxDB())
client := app.NewHTTPClient(nil)
_, from := cltest.MustInsertRandomKey(t, app.KeyStore.Eth())
tx := cltest.MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t, txStore, 1, from)
Expand Down
2 changes: 1 addition & 1 deletion core/web/evm_tx_attempts_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestTxAttemptsController_Index_Success(t *testing.T) {
app := cltest.NewApplicationWithKey(t)
require.NoError(t, app.Start(testutils.Context(t)))

txStore := cltest.NewTestTxStore(t, app.GetSqlxDB(), app.GetConfig().Database())
txStore := cltest.NewTestTxStore(t, app.GetSqlxDB())
client := app.NewHTTPClient(nil)

_, from := cltest.MustInsertRandomKey(t, app.KeyStore.Eth())
Expand Down

0 comments on commit 80186d0

Please sign in to comment.