mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
make bidding tests independent (#322)
This commit is contained in:
parent
d887266c24
commit
2be1a3196e
@ -36,26 +36,6 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
collateralAddrs := addrs[2:]
|
collateralAddrs := addrs[2:]
|
||||||
collateralWeights := is(30, 20, 10)
|
collateralWeights := is(30, 20, 10)
|
||||||
|
|
||||||
tApp := app.NewTestApp()
|
|
||||||
|
|
||||||
// Set up seller account
|
|
||||||
sellerAcc := supply.NewEmptyModuleAccount(modName, supply.Minter, supply.Burner)
|
|
||||||
require.NoError(t, sellerAcc.SetCoins(cs(c("token1", 1000), c("token2", 1000), c("debt", 1000))))
|
|
||||||
|
|
||||||
// Initialize genesis accounts
|
|
||||||
tApp.InitializeFromGenesisStates(
|
|
||||||
NewAuthGenStateFromAccs(authexported.GenesisAccounts{
|
|
||||||
auth.NewBaseAccount(buyer, cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
|
||||||
auth.NewBaseAccount(secondBuyer, cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
|
||||||
auth.NewBaseAccount(collateralAddrs[0], cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
|
||||||
auth.NewBaseAccount(collateralAddrs[1], cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
|
||||||
auth.NewBaseAccount(collateralAddrs[2], cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
|
||||||
sellerAcc,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
ctx := tApp.NewContext(false, abci.Header{})
|
|
||||||
keeper := tApp.GetAuctionKeeper()
|
|
||||||
|
|
||||||
type auctionArgs struct {
|
type auctionArgs struct {
|
||||||
auctionType AuctionType
|
auctionType AuctionType
|
||||||
seller string
|
seller string
|
||||||
@ -285,6 +265,25 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
// Setup test
|
||||||
|
tApp := app.NewTestApp()
|
||||||
|
// Set up seller account
|
||||||
|
sellerAcc := supply.NewEmptyModuleAccount(modName, supply.Minter, supply.Burner)
|
||||||
|
require.NoError(t, sellerAcc.SetCoins(cs(c("token1", 1000), c("token2", 1000), c("debt", 1000))))
|
||||||
|
// Initialize genesis accounts
|
||||||
|
tApp.InitializeFromGenesisStates(
|
||||||
|
NewAuthGenStateFromAccs(authexported.GenesisAccounts{
|
||||||
|
auth.NewBaseAccount(buyer, cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
||||||
|
auth.NewBaseAccount(secondBuyer, cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
||||||
|
auth.NewBaseAccount(collateralAddrs[0], cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
||||||
|
auth.NewBaseAccount(collateralAddrs[1], cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
||||||
|
auth.NewBaseAccount(collateralAddrs[2], cs(c("token1", 1000), c("token2", 1000)), nil, 0, 0),
|
||||||
|
sellerAcc,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
ctx := tApp.NewContext(false, abci.Header{})
|
||||||
|
keeper := tApp.GetAuctionKeeper()
|
||||||
|
|
||||||
// Start Auction
|
// Start Auction
|
||||||
var id uint64
|
var id uint64
|
||||||
var err sdk.Error
|
var err sdk.Error
|
||||||
|
Loading…
Reference in New Issue
Block a user