2023-05-11 07:50:07 +00:00
|
|
|
package accounts
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2023-07-10 15:00:35 +00:00
|
|
|
func MockTestAccounts(tb testing.TB, db *sql.DB, accounts []*Account) {
|
2023-05-11 07:50:07 +00:00
|
|
|
d, err := NewDB(db)
|
2023-07-10 15:00:35 +00:00
|
|
|
require.NoError(tb, err)
|
2023-05-11 07:50:07 +00:00
|
|
|
|
2023-06-28 19:45:36 +00:00
|
|
|
err = d.SaveOrUpdateAccounts(accounts, false)
|
2023-07-10 15:00:35 +00:00
|
|
|
require.NoError(tb, err)
|
2023-05-11 07:50:07 +00:00
|
|
|
res, err := d.GetAccounts()
|
2023-07-10 15:00:35 +00:00
|
|
|
require.NoError(tb, err)
|
|
|
|
require.Equal(tb, accounts[0].Address, res[0].Address)
|
2023-05-11 07:50:07 +00:00
|
|
|
}
|