-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(vpool): Lots of testing for 'nibid q vpool all-pools'. (#830)
* vpool test query_server #wip * test: add marginRatioIndex check to the perp cli_test * test: GetPoolPrices. Also made blank Dec fields nullable. * appease linter * clean away leftover TODO comment * update changelog * feat,test(vpool): add pair field to PoolPrices allow index price and TWAP to be empty instead of defaulting to zero * docs: CHANGELOG.md
- Loading branch information
1 parent
402101d
commit fb1cb6b
Showing
16 changed files
with
641 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package mock | ||
|
||
import ( | ||
"testing" | ||
|
||
sdktestsmocks "github.com/cosmos/cosmos-sdk/tests/mocks" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
gomock "github.com/golang/mock/gomock" | ||
) | ||
|
||
/* AppendCtxWithMockLogger sets the logger for an input context as a mock logger | ||
with 'EXPECT' statements. This enables testing on functions logged to the context. | ||
For example, | ||
```go | ||
// This is a passing test example | ||
import ( | ||
gomock "github.com/golang/mock/gomock" | ||
sdktestsmocks "github.com/cosmos/cosmos-sdk/tests/mocks" | ||
) | ||
// assume t is a *testing.T variable. | ||
ctx, logger := AppendCtxWithMockLogger(t, ctx) | ||
logger.EXPECT().Debug("debug") | ||
logger.EXPECT().Info("info") | ||
logger.EXPECT().Error("error") | ||
ctx.Logger().Debug("debug") | ||
ctx.Logger().Info("info") | ||
ctx.Logger().Error("error") | ||
``` | ||
*/ | ||
func AppendCtxWithMockLogger(t *testing.T, ctx sdk.Context) (sdk.Context, *sdktestsmocks.MockLogger) { | ||
ctrl := gomock.NewController(t) | ||
logger := sdktestsmocks.NewMockLogger(ctrl) | ||
return ctx.WithLogger(logger), logger | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.