2021-03-11 13:28:00 -06:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestToMacaronPath(t *testing.T) {
|
|
|
|
testCases := []struct {
|
|
|
|
inputPath string
|
|
|
|
expectedOutputPath string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
inputPath: "",
|
|
|
|
expectedOutputPath: "",
|
|
|
|
},
|
|
|
|
{
|
2022-04-20 08:20:17 -05:00
|
|
|
inputPath: "/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}",
|
|
|
|
expectedOutputPath: "/ruler/:DatasourceID/api/v1/rules/:Namespace/:Groupname",
|
2021-03-11 13:28:00 -06:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
|
|
outputPath := toMacaronPath(tc.inputPath)
|
|
|
|
assert.Equal(t, tc.expectedOutputPath, outputPath)
|
|
|
|
}
|
|
|
|
}
|