Welcome to mirror list, hosted at ThFree Co, Russian Federation.

helpers_test.go « redirects « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 988a9a8cee639572fb4d7fe5136212c4dd4a4610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package redirects

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func Test_normalizePath(t *testing.T) {
	tests := map[string]struct {
		name     string
		path     string
		expected string
	}{
		"add_trailing_slash": {
			path:     "foo",
			expected: "foo/",
		},
		"leave_existing_trailing_slash": {
			path:     "foo/",
			expected: "foo/",
		},
		"leave_existing_double_trailing_slash": {
			path:     "foo//",
			expected: "foo//",
		},
	}

	for name, tt := range tests {
		t.Run(name, func(t *testing.T) {
			got := normalizePath(tt.path)
			require.Equal(t, tt.expected, got)
		})
	}
}