package string_utils

import "testing"

func TestHumanReadableToKey(t *testing.T) {
	type args struct {
		humanReadableString string
		separator           string
	}
	tests := []struct {
		name string
		args args
		want string
	}{
		{
			name: "leading capitals with underscore",
			args: args{"Test Courier Name", "_"},
			want: "test_courier_name",
		},
		{
			name: "leading capitals with hyphen",
			args: args{"Test Courier Name", "-"},
			want: "test-courier-name",
		},
		{
			name: "all lowercase with underscore",
			args: args{"test courier name", "_"},
			want: "test_courier_name",
		},
		{
			name: "random capitalisation with hyphen",
			args: args{"tEsT CoURIer NAME", "-"},
			want: "test-courier-name",
		},
		{
			name: "weird characters",
			args: args{"Tes*t $#@! (Couriers)", "_"},
			want: "tes*t_$#@!_(couriers)",
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := HumanReadableToKey(tt.args.humanReadableString, tt.args.separator); got != tt.want {
				t.Errorf("HumanReadableToKey() = %v, want %v", got, tt.want)
			}
		})
	}
}