Home / Function/ TestNormalizePath() — fiber Function Reference

TestNormalizePath() — fiber Function Reference

Architecture documentation for the TestNormalizePath() function in router_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  7c2f43cc_8121_1c91_e5b9_3e9d331234b6["TestNormalizePath()"]
  326d7e00_9e4f_d854_0c78_b9c0c93e5537["router_test.go"]
  7c2f43cc_8121_1c91_e5b9_3e9d331234b6 -->|defined in| 326d7e00_9e4f_d854_0c78_b9c0c93e5537
  style 7c2f43cc_8121_1c91_e5b9_3e9d331234b6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

router_test.go lines 1253–1324

func TestNormalizePath(t *testing.T) {
	tests := []struct {
		name          string
		path          string
		expected      string
		caseSensitive bool
		strictRouting bool
	}{
		{
			name:          "Empty path",
			path:          "",
			caseSensitive: true,
			strictRouting: true,
			expected:      "/",
		},
		{
			name:          "No leading slash",
			path:          "users",
			caseSensitive: true,
			strictRouting: true,
			expected:      "/users",
		},
		{
			name:          "With trailing slash and strict routing",
			path:          "/users/",
			caseSensitive: true,
			strictRouting: true,
			expected:      "/users/",
		},
		{
			name:          "With trailing slash and non-strict routing",
			path:          "/users/",
			caseSensitive: true,
			strictRouting: false,
			expected:      "/users",
		},
		{
			name:          "Case sensitive",
			path:          "/Users",
			caseSensitive: true,
			strictRouting: true,
			expected:      "/Users",
		},
		{
			name:          "Case insensitive",
			path:          "/Users",
			caseSensitive: false,
			strictRouting: true,
			expected:      "/users",
		},
		{
			name:          "With escape characters",
			path:          "/users\\/profile",
			caseSensitive: true,
			strictRouting: true,
			expected:      "/users/profile",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			app := &App{
				config: Config{
					CaseSensitive: tt.caseSensitive,
					StrictRouting: tt.strictRouting,
				},
			}
			result := app.normalizePath(tt.path)
			require.Equal(t, tt.expected, result)
		})
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestNormalizePath() do?
TestNormalizePath() is a function in the fiber codebase, defined in router_test.go.
Where is TestNormalizePath() defined?
TestNormalizePath() is defined in router_test.go at line 1253.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free