MCPcopy
hub / github.com/labstack/echo / TestDefaultRouter_Remove

Function TestDefaultRouter_Remove

router_test.go:2920–3046  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2918}
2919
2920func TestDefaultRouter_Remove(t *testing.T) {
2921 var testCases = []struct {
2922 name string
2923 whenMethod string
2924 whenPath string
2925 expectErr string
2926 givenPaths []string
2927 }{
2928 {
2929 name: "ok, static",
2930 whenPath: "/users",
2931 },
2932 {
2933 name: "ok, static without slash",
2934 whenPath: "users",
2935 },
2936 {
2937 name: "ok, multilevel static",
2938 whenPath: "/users/newsee",
2939 },
2940 {
2941 name: "ok, static with path params",
2942 whenPath: "/users/:id/files",
2943 },
2944 {
2945 name: "ok, path params",
2946 whenPath: "/users/:id",
2947 },
2948 {
2949 name: "ok, any",
2950 whenPath: "/users/new/*",
2951 },
2952 {
2953 name: "ok, any root",
2954 whenPath: "/*",
2955 },
2956 {
2957 name: "ok, multilevel any",
2958 whenPath: "/users/dew/*",
2959 },
2960 {
2961 name: "ok, single root",
2962 givenPaths: []string{"/users"},
2963 whenPath: "/users",
2964 },
2965 {
2966 name: "nok, no routes, nothing to remove",
2967 givenPaths: []string{},
2968 whenPath: "/users/",
2969 expectErr: "router has no routes to remove",
2970 },
2971 {
2972 name: "nok, route not found (matches partial node)",
2973 whenPath: "/users/",
2974 expectErr: "could not find route to remove by given path",
2975 },
2976 {
2977 name: "nok, route not found (matches partial node)",

Callers

nothing calls this directly

Calls 7

PathMethod · 0.95
NewFunction · 0.85
RouterMethod · 0.80
NewContextMethod · 0.80
RemoveMethod · 0.65
RouteMethod · 0.65
GETMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…