chore: merge backend repo history into monorepo at backend/

git-subtree-dir: backend
git-subtree-mainline: dc11190527
git-subtree-split: acae976622
This commit is contained in:
2026-09-27 10:30:16 +03:30
67 changed files with 6835 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package utils
import (
"testing"
"time"
)
func TestCalcAge_NilBirthDate(t *testing.T) {
if age := CalcAge(nil); age != 0 {
t.Fatalf("expected 0 for nil birth date, got %d", age)
}
}
func TestCalcAge_BirthdayAlreadyPassedThisYear(t *testing.T) {
birth := time.Now().AddDate(-25, -1, 0) // ۲۵ سال و ۱ ماه پیش -> تولد امسال رد شده
if age := CalcAge(&birth); age != 25 {
t.Fatalf("expected age 25, got %d", age)
}
}
func TestCalcAge_BirthdayNotYetThisYear(t *testing.T) {
birth := time.Now().AddDate(-25, 1, 0) // تولد ۱ ماه دیگه‌ست -> هنوز ۲۴ سالشه
if age := CalcAge(&birth); age != 24 {
t.Fatalf("expected age 24, got %d", age)
}
}