|
|
|
|
@ -4,7 +4,6 @@ import (
|
|
|
|
|
"context"
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/PuerkitoBio/goquery"
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
@ -27,6 +26,7 @@ const mockHtml = `
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Gregorian Calendar Date</th>
|
|
|
|
|
<th>Hijri Date</th>
|
|
|
|
|
<th>Fajr</th>
|
|
|
|
|
<th>Sun</th>
|
|
|
|
|
<th>Dhuhr</th>
|
|
|
|
|
@ -38,6 +38,7 @@ const mockHtml = `
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>04.03.2023</td>
|
|
|
|
|
<td>...</td>
|
|
|
|
|
<td>05:48</td>
|
|
|
|
|
<td>07:11</td>
|
|
|
|
|
<td>13:05</td>
|
|
|
|
|
@ -47,6 +48,7 @@ const mockHtml = `
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>05.03.2023</td>
|
|
|
|
|
<td>...</td>
|
|
|
|
|
<td>05:46</td>
|
|
|
|
|
<td>07:09</td>
|
|
|
|
|
<td>13:04</td>
|
|
|
|
|
@ -76,7 +78,7 @@ func TestDiyanet_Get(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
expected := []prayer.Times{
|
|
|
|
|
{
|
|
|
|
|
Date: time.Date(2023, time.March, 4, 0, 0, 0, 0, time.UTC),
|
|
|
|
|
Date: "2023-03-04",
|
|
|
|
|
Fajr: "05:48",
|
|
|
|
|
Sunrise: "07:11",
|
|
|
|
|
Dhuhr: "13:05",
|
|
|
|
|
@ -85,7 +87,7 @@ func TestDiyanet_Get(t *testing.T) {
|
|
|
|
|
Isha: "20:06",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Date: time.Date(2023, time.March, 5, 0, 0, 0, 0, time.UTC),
|
|
|
|
|
Date: "2023-03-05",
|
|
|
|
|
Fajr: "05:46",
|
|
|
|
|
Sunrise: "07:09",
|
|
|
|
|
Dhuhr: "13:04",
|
|
|
|
|
@ -105,9 +107,13 @@ func TestDiyanet_Get(t *testing.T) {
|
|
|
|
|
d := Provider{
|
|
|
|
|
FetcherFunc: net.GetParsed,
|
|
|
|
|
}
|
|
|
|
|
times, err := d.Get(context.Background(), "9205")
|
|
|
|
|
times, err := d.Get(context.Background(), "11104")
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
assert.Greater(t, len(times), 1)
|
|
|
|
|
assert.NotZero(t, times[0].Date)
|
|
|
|
|
|
|
|
|
|
for _, it := range times {
|
|
|
|
|
t.Logf("%+v", it)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|