summaryrefslogtreecommitdiff
path: root/internal/tools/profile/profile_test.go
blob: 1a11fddd25e295593d97db565c3cb1405651b71c (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
package profile

import "testing"

func TestProfileDirFromArgs(t *testing.T) {
	tests := []struct {
		name string
		args []string
		want string
	}{
		{
			name: "explicit profile dir",
			args: []string{"-profile", "-profiledir", "custom-profiles", "-plain"},
			want: "custom-profiles",
		},
		{
			name: "missing profile dir falls back to default",
			args: []string{"-profile", "-plain"},
			want: "profiles",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := profileDirFromArgs(tt.args); got != tt.want {
				t.Fatalf("profileDirFromArgs(%v) = %q, want %q", tt.args, got, tt.want)
			}
		})
	}
}