mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
fix: fix bug with trailing version info not being properly stripped (#14963)
Fixes a bug where excess version info was not being stripped properly from documentation links.
This commit is contained in:
committed by
GitHub
parent
52f03dbdf2
commit
20bfd1f874
36
codersdk/deployment_internal_test.go
Normal file
36
codersdk/deployment_internal_test.go
Normal file
@ -0,0 +1,36 @@
|
||||
package codersdk
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestRemoveTrailingVersionInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
Version string
|
||||
ExpectedAfterStrippingInfo string
|
||||
}{
|
||||
{
|
||||
Version: "v2.16.0+683a720",
|
||||
ExpectedAfterStrippingInfo: "v2.16.0",
|
||||
},
|
||||
{
|
||||
Version: "v2.16.0-devel+683a720",
|
||||
ExpectedAfterStrippingInfo: "v2.16.0",
|
||||
},
|
||||
{
|
||||
Version: "v2.16.0+683a720-devel",
|
||||
ExpectedAfterStrippingInfo: "v2.16.0",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
stripped := removeTrailingVersionInfo(tc.Version)
|
||||
require.Equal(t, tc.ExpectedAfterStrippingInfo, stripped)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user