package app import ( "testing" "git.5iot.com/iotlcm-public/iotlcm-app/internal/model/entity" ) func TestAppBalancePayerDeptIdPrefersExplicitDepartment(t *testing.T) { user := &entity.SysUser{DeptId: 175} if got := appBalancePayerDeptId(user, 185); got != 185 { t.Fatalf("appBalancePayerDeptId() = %d, want 185", got) } } func TestAppBalancePayerDeptIdFallsBackToUserDepartment(t *testing.T) { user := &entity.SysUser{DeptId: 175} if got := appBalancePayerDeptId(user, 0); got != 175 { t.Fatalf("appBalancePayerDeptId() = %d, want 175", got) } } func TestAppBalancePayerDeptIdReturnsZeroForNilUser(t *testing.T) { if got := appBalancePayerDeptId(nil, 0); got != 0 { t.Fatalf("appBalancePayerDeptId() = %d, want 0", got) } }