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
38 lines
832 B
Go
38 lines
832 B
Go
package field
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/ignite/cli/v29/ignite/pkg/multiformatname"
|
|
"github.com/ignite/cli/v29/ignite/templates/field/datatype"
|
|
)
|
|
|
|
func TestFieldsCustom(t *testing.T) {
|
|
nameA, err := multiformatname.NewName("customA")
|
|
require.NoError(t, err)
|
|
nameB, err := multiformatname.NewName("customB")
|
|
require.NoError(t, err)
|
|
nameC, err := multiformatname.NewName("customC")
|
|
require.NoError(t, err)
|
|
|
|
fields := Fields{
|
|
{
|
|
Name: nameA,
|
|
DatatypeName: datatype.Custom,
|
|
Datatype: "ProductDetails",
|
|
},
|
|
{
|
|
Name: nameB,
|
|
DatatypeName: datatype.CustomSlice,
|
|
Datatype: "LineItem",
|
|
},
|
|
{
|
|
Name: nameC,
|
|
DatatypeName: datatype.String,
|
|
},
|
|
}
|
|
|
|
require.Equal(t, []string{"product_details", "line_item"}, fields.Custom())
|
|
}
|