package bootstrap

import "testing"

func TestPluralize(t *testing.T) {
	tests := []struct {
		input string
		want  string
	}{
		// Regular: append "s"
		{"Account", "Accounts"},
		{"Contact", "Contacts"},
		{"Lead", "Leads"},

		// Consonant + y → ies
		{"Opportunity", "Opportunities"},
		{"Activity", "Activities"},
		{"Company", "Companies"},

		// Vowel + y → s (not ies)
		{"Key", "Keys"},
		{"Day", "Days"},
		{"Survey", "Surveys"},

		// Ends in s → es
		{"Address", "Addresses"},
		{"Status", "Statuses"},
		{"Process", "Processes"},

		// Ends in x → es
		{"Tax", "Taxes"},
		{"Box", "Boxes"},

		// Ends in z → double z + es (consonant doubling)
		{"Quiz", "Quizzes"},
		{"Buzz", "Buzzes"},

		// Ends in sh → es
		{"Bush", "Bushes"},
		{"Dash", "Dashes"},

		// Ends in ch → es
		{"Approach", "Approaches"},
		{"Match", "Matches"},

		// Already plural (non-sibilant "s") → unchanged
		{"Object Permissions", "Object Permissions"},
		{"Field Permissions", "Field Permissions"},
		{"Users", "Users"},
		{"Items", "Items"},

		// Edge: empty string
		{"", ""},

		// Single character
		{"s", "s"},
	}

	for _, tt := range tests {
		t.Run(tt.input, func(t *testing.T) {
			got := pluralize(tt.input)
			if got != tt.want {
				t.Errorf("pluralize(%q) = %q, want %q", tt.input, got, tt.want)
			}
		})
	}
}
