package adminfinance

import "testing"

func TestDailyDateKey(t *testing.T) {
	tests := []struct {
		name string
		in   string
		want string
	}{
		{name: "date only", in: "2026-06-15", want: "2026-06-15"},
		{name: "datetime", in: "2026-06-15 00:00:00", want: "2026-06-15"},
		{name: "rfc3339", in: "2026-06-15T00:00:00+08:00", want: "2026-06-15"},
		{name: "trim spaces", in: " 2026-06-15T00:00:00Z ", want: "2026-06-15"},
		{name: "short value", in: "2026-06", want: "2026-06"},
	}

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