Some checks failed
Docs Deploy / build_and_deploy (push) Has been cancelled
Generate Docs / cli (push) Has been cancelled
Generate Config Doc / cli (push) Has been cancelled
Go formatting / go-formatting (push) Has been cancelled
Check links / markdown-link-check (push) Has been cancelled
Integration / pre-test (push) Has been cancelled
Integration / test on (push) Has been cancelled
Integration / status (push) Has been cancelled
Lint / Lint Go code (push) Has been cancelled
Test / test (ubuntu-latest) (push) Has been cancelled
38 lines
741 B
Go
38 lines
741 B
Go
package chain_test
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ignite/ignite/config/chain"
|
|
"git.cw.tr/mukan-network/mukan-ignite/ignite/config/chain/version"
|
|
)
|
|
|
|
func TestCheckVersion(t *testing.T) {
|
|
// Arrange
|
|
cfg := bytes.NewBufferString(
|
|
fmt.Sprintf("version: %d", chain.LatestVersion),
|
|
)
|
|
|
|
// Act
|
|
err := chain.CheckVersion(cfg)
|
|
|
|
// Assert
|
|
require.NoError(t, err)
|
|
}
|
|
|
|
func TestCheckVersionWithOutdatedVersion(t *testing.T) {
|
|
// Arrange
|
|
cfg := bytes.NewBufferString("version: 0")
|
|
wantError := chain.VersionError{}
|
|
|
|
// Act
|
|
err := chain.CheckVersion(cfg)
|
|
|
|
// Assert
|
|
require.ErrorAs(t, err, &wantError)
|
|
require.Equal(t, wantError.Version, version.Version(0))
|
|
}
|