-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
validation: unit test for zero values after read from standard tomls (#…
…716) * validation: unit test for zero values after read from standard tomls * add more release-specific unit tests * improve versions.Release[Release] test
- Loading branch information
1 parent
d98924a
commit c56b992
Showing
3 changed files
with
175 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package standard | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestConfigInitialization(t *testing.T) { | ||
t.Run("Release", func(t *testing.T) { | ||
require.NotEmpty(t, Release, "Release should not be empty") | ||
}) | ||
|
||
t.Run("BytecodeHashes", func(t *testing.T) { | ||
require.NotNil(t, BytecodeHashes[Release], "BytecodeHashes should not be nil") | ||
require.NotZero(t, len(BytecodeHashes), "BytecodeHashes should not be empty") | ||
}) | ||
|
||
t.Run("BytecodeImmutables", func(t *testing.T) { | ||
require.NotNil(t, BytecodeImmutables[Release], "BytecodeImmutables should not be nil") | ||
require.NotZero(t, len(BytecodeImmutables), "BytecodeImmutables should not be empty") | ||
}) | ||
|
||
require.NotNil(t, Config, "Config should not be nil") | ||
require.NotNil(t, Config.Params, "Config.Params should not be nil") | ||
require.NotNil(t, Config.Roles, "Config.Roles should not be nil") | ||
require.NotNil(t, Config.MultisigRoles, "Config.MultisigRoles should not be nil") | ||
|
||
// Check individual network configurations | ||
networks := []string{"mainnet", "sepolia"} | ||
for _, network := range networks { | ||
t.Run(fmt.Sprintf("Params[%s]", network), func(t *testing.T) { | ||
// Ensure network Params are populated | ||
require.NotNil(t, Config.Params[network], "Config.Params[%s] should not be nil", network) | ||
require.NoError(t, Config.Params[network].Check(), "Config.Params[%s] has invalid zero value", network) | ||
}) | ||
|
||
t.Run(fmt.Sprintf("MultisigRoles[%s]", network), func(t *testing.T) { | ||
// Ensure network MultisigRoles are populated | ||
require.NotNil(t, Config.MultisigRoles[network], "Config.MultisigRoles[%s] should not be nil", network) | ||
require.NotZero(t, Config.MultisigRoles[network], "Config.MultisigRoles[%s] should not be zero value", network) | ||
}) | ||
|
||
t.Run(fmt.Sprintf("NetworkVersion[%s]", network), func(t *testing.T) { | ||
// Ensure network Versions are populated | ||
versions, ok := NetworkVersions[network] | ||
require.True(t, ok, "NetworkVersions[%s] should exist", network) | ||
require.NotNil(t, versions, "NetworkVersions[%s] should not be nil", network) | ||
require.NotZero(t, len(versions.Releases), "NetworkVersions[%s].Releases should not be empty", network) | ||
|
||
_, ok = versions.Releases[Release] | ||
require.True(t, ok, "NetworkVersions[%s].Releases[%s] should exist", network, Release) | ||
|
||
_, ok = versions.Releases["fake-release"] | ||
require.False(t, ok, "NetworkVersions[%s].Releases[%s] should not exist", network, Release) | ||
}) | ||
} | ||
} |
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