Skip to content

Commit

Permalink
Merge branch 'main' into faddat/merge-carlos-upgrade-v8
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat authored Sep 16, 2023
2 parents c32917d + f4e1f71 commit 3acd9d4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions modules/core/24-host/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,29 @@ func TestMustParseClientStatePath(t *testing.T) {
}
}
}

func TestMustParseConnectionPath(t *testing.T) {
testCases := []struct {
name string
path string
expected string
expPass bool
}{
{"valid", "a/connection", "connection", true},
{"valid localhost", "/connection-localhost", "connection-localhost", true},
{"invalid empty path", "", "", false},
}

for _, tc := range testCases {
if tc.expPass {
require.NotPanics(t, func() {
connID := host.MustParseConnectionPath(tc.path)
require.Equal(t, connID, tc.expected)
})
} else {
require.Panics(t, func() {
host.MustParseConnectionPath(tc.path)
})
}
}
}

0 comments on commit 3acd9d4

Please sign in to comment.