Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
44 lines
814 B
Go
44 lines
814 B
Go
package xyaml_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"gopkg.in/yaml.v3"
|
|
|
|
"github.com/ignite/cli/v29/ignite/pkg/xyaml"
|
|
)
|
|
|
|
func TestUnmarshalWithCustomMapType(t *testing.T) {
|
|
// Arrange
|
|
input := `
|
|
foo:
|
|
bar: baz
|
|
`
|
|
output := xyaml.Map{}
|
|
|
|
// Act
|
|
err := yaml.Unmarshal([]byte(input), &output)
|
|
|
|
// Assert
|
|
require.NoError(t, err)
|
|
require.NotNil(t, output["foo"])
|
|
require.IsType(t, (map[string]interface{})(nil), output["foo"])
|
|
}
|
|
|
|
func TestUnmarshalWithNativeMapType(t *testing.T) {
|
|
// Arrange
|
|
input := `
|
|
foo:
|
|
bar: baz
|
|
`
|
|
output := make(map[string]interface{})
|
|
|
|
// Act
|
|
err := yaml.Unmarshal([]byte(input), &output)
|
|
|
|
// Assert
|
|
require.NoError(t, err)
|
|
require.NotNil(t, output["foo"])
|
|
require.IsType(t, (map[string]interface{})(nil), output["foo"])
|
|
}
|