Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
isinyaaa committed Aug 22, 2024
1 parent 37be89d commit 4a942a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion internal/converter/mlmd_converter_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ func TestPrefixWhenOwnedWithoutOwner(t *testing.T) {
assertion.Equal("name", strings.Split(prefixed, ":")[1])
}

func TestPrefixNameWithColonWhenOwned(t *testing.T) {
assertion := setup(t)

owner := "owner"
entity := "name:with:colon"
assertion.Equal("owner:name:with:colon", PrefixWhenOwned(&owner, entity))
}

func TestMapRegisteredModelProperties(t *testing.T) {
assertion := setup(t)

Expand Down Expand Up @@ -578,7 +586,7 @@ func TestMapNameFromOwned(t *testing.T) {
assertion.Equal("name", *name)

name = MapNameFromOwned(of("prefix:name:postfix"))
assertion.Equal("name", *name)
assertion.Equal("name:postfix", *name)

name = MapNameFromOwned(nil)
assertion.Nil(name)
Expand Down
4 changes: 3 additions & 1 deletion internal/converter/mlmd_openapi_converter_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ func MapNameFromOwned(source *string) *string {
if len(exploded) == 1 {
return source
}
return &exploded[1]
// cat remaining parts of the exploded string
joined := strings.Join(exploded[1:], ":")
return &joined
}

// MapName derive the entity name from the mlmd fullname
Expand Down

0 comments on commit 4a942a7

Please sign in to comment.