MCPcopy Create free account
hub / github.com/akash-network/node / TestAPI

Function TestAPI

util/partialord/partialord_test.go:11–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestAPI(t *testing.T) {
12 // begin block use case, we have a dozen modules, but only care about a couple orders.
13 // In practice this will be gotten from some API, e.g. app.AllModuleNames()
14 moduleNames := []string{
15 "auth", "authz", "bank", "capabilities",
16 "staking", "distribution", "epochs", "mint", "upgrades", "wasm", "ibc",
17 "ibctransfers",
18 }
19 beginBlockOrd := partialord.NewPartialOrdering(moduleNames)
20 beginBlockOrd.FirstElements("upgrades", "epochs", "capabilities")
21 beginBlockOrd.After("ibctransfers", "ibc")
22 beginBlockOrd.Before("mint", "distribution")
23 // This is purely just to test last functionality, doesn't make sense in context
24 beginBlockOrd.LastElements("auth", "authz", "wasm")
25
26 totalOrd := beginBlockOrd.TotalOrdering()
27 expTotalOrd := []string{
28 "upgrades", "epochs", "capabilities",
29 "bank", "ibc", "mint", "staking", "ibctransfers", "distribution",
30 "auth", "authz", "wasm",
31 }
32 require.Equal(t, expTotalOrd, totalOrd)
33}
34
35func TestNonStandardAPIOrder(t *testing.T) {
36 // This test uses direct ordering before First, and after Last

Callers

nothing calls this directly

Calls 6

FirstElementsMethod · 0.95
AfterMethod · 0.95
BeforeMethod · 0.95
LastElementsMethod · 0.95
TotalOrderingMethod · 0.95
NewPartialOrderingFunction · 0.92

Tested by

no test coverage detected