feat: Return location info and Hijri date from the prayer times endpoint

This commit is contained in:
abdus committed 2026-02-21 02:07:22 +03:00
1 parent 07a9703a89
commit c106d57fe6
9 files changed
+358 -87

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
package hijricalendar
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestToISODate(t *testing.T) {
tests := []struct {
name string
date time.Time
want string
}{
{
name: "ramadan 3 1447",
date: time.Date(2026, 2, 20, 0, 0, 0, 0, time.UTC),
want: "1447-09-03",
},
{
name: "ramadan 1 1447",
date: time.Date(2026, 2, 18, 0, 0, 0, 0, time.UTC),
want: "1447-09-01",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ToISODate(tt.date)
require.NotEmpty(t, got)
assert.Equal(t, tt.want, got)
})
}
}
func TestGregorianToIslamicRange(t *testing.T) {
y, m, d := GregorianToIslamic(2026, 2, 20)
assert.Positive(t, y)
assert.GreaterOrEqual(t, m, 1)
assert.LessOrEqual(t, m, 12)
assert.GreaterOrEqual(t, d, 1)
assert.LessOrEqual(t, d, 30)
}