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
59 lines
1.2 KiB
Go
59 lines
1.2 KiB
Go
package cosmosgen
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ignite/ignite/pkg/cosmosanalysis/module"
|
|
"git.cw.tr/mukan-network/mukan-ignite/ignite/pkg/protoanalysis"
|
|
)
|
|
|
|
func TestTypescriptModulePath(t *testing.T) {
|
|
modulePath := TypescriptModulePath("prefix")
|
|
|
|
cases := []struct {
|
|
name string
|
|
goModulePath string
|
|
protoPkgName string
|
|
want string
|
|
}{
|
|
{
|
|
name: "github uri",
|
|
goModulePath: "github.com/owner/app",
|
|
protoPkgName: "owner.app.module",
|
|
want: "prefix/owner.app.module",
|
|
},
|
|
{
|
|
name: "short uri",
|
|
goModulePath: "domain.com/app",
|
|
protoPkgName: "app.module",
|
|
want: "prefix/app.module",
|
|
},
|
|
{
|
|
name: "path",
|
|
goModulePath: "owner/app",
|
|
protoPkgName: "owner.app.module",
|
|
want: "prefix/owner.app.module",
|
|
},
|
|
{
|
|
name: "name",
|
|
goModulePath: "app",
|
|
protoPkgName: "app.module",
|
|
want: "prefix/app.module",
|
|
},
|
|
}
|
|
|
|
for _, tt := range cases {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
m := module.Module{
|
|
GoModulePath: tt.goModulePath,
|
|
Pkg: protoanalysis.Package{
|
|
Name: tt.protoPkgName,
|
|
},
|
|
}
|
|
|
|
require.Equal(t, tt.want, modulePath(m))
|
|
})
|
|
}
|
|
}
|