1
- import { getAyahMeta , meta } from "../src"
1
+ import { getAyahMeta , meta , RukuList } from "../src"
2
2
3
3
describe ( "ayahMeta" , ( ) => {
4
4
it ( "should return correct metadata for the first ayah" , ( ) => {
@@ -12,6 +12,9 @@ describe("ayahMeta", () => {
12
12
expect ( result . isEndOfJuz ) . toBeFalsy ( )
13
13
expect ( result . isEndOfQuarter ) . toBeFalsy ( )
14
14
expect ( result . isSajdahAyah ) . toBeFalsy ( )
15
+ expect ( result . isEndOfRuku ) . toBeFalsy ( )
16
+ expect ( result . isStartOfRuku ) . toBeTruthy ( )
17
+ expect ( result . ruku ) . toBe ( 1 )
15
18
} )
16
19
17
20
it ( "should return correct metadata for the 7th ayah" , ( ) => {
@@ -23,6 +26,9 @@ describe("ayahMeta", () => {
23
26
expect ( result . isEndOfPage ) . toBeTruthy ( )
24
27
expect ( result . isEndOfJuz ) . toBeFalsy ( )
25
28
expect ( result . isSajdahAyah ) . toBeFalsy ( )
29
+ expect ( result . isStartOfRuku ) . toBeFalsy ( )
30
+ expect ( result . isEndOfRuku ) . toBeTruthy ( )
31
+ expect ( result . ruku ) . toBe ( 1 )
26
32
} )
27
33
28
34
it ( "should return correct metadata for the 8th ayah" , ( ) => {
@@ -33,7 +39,36 @@ describe("ayahMeta", () => {
33
39
expect ( result . isEndOfSurah ) . toBeFalsy ( )
34
40
expect ( result . isEndOfPage ) . toBeFalsy ( )
35
41
expect ( result . isEndOfJuz ) . toBeFalsy ( )
42
+ expect ( result . isEndOfRuku ) . toBeFalsy ( )
43
+ expect ( result . isStartOfRuku ) . toBeTruthy ( )
44
+ expect ( result . ruku ) . toBe ( 2 )
45
+ expect ( result . isSajdahAyah ) . toBeFalsy ( )
46
+ } )
36
47
48
+ it ( "should return correct metadata for the 14th ayah" , ( ) => {
49
+ const result = getAyahMeta ( 14 )
50
+ expect ( result . isStartOfSurah ) . toBeFalsy ( )
51
+ // expect(result.isStartOfPage).toBeTruthy()
52
+ expect ( result . isStartOfJuz ) . toBeFalsy ( )
53
+ expect ( result . isEndOfSurah ) . toBeFalsy ( )
54
+ expect ( result . isEndOfPage ) . toBeFalsy ( )
55
+ expect ( result . isEndOfJuz ) . toBeFalsy ( )
56
+ expect ( result . isEndOfRuku ) . toBeTruthy ( )
57
+ expect ( result . isStartOfRuku ) . toBeFalsy ( )
58
+ expect ( result . ruku ) . toBe ( 2 )
59
+ expect ( result . isSajdahAyah ) . toBeFalsy ( )
60
+ } )
61
+ it ( "should return correct metadata for the 15th ayah" , ( ) => {
62
+ const result = getAyahMeta ( 15 )
63
+ expect ( result . isStartOfSurah ) . toBeFalsy ( )
64
+ // expect(result.isStartOfPage).toBeTruthy()
65
+ expect ( result . isStartOfJuz ) . toBeFalsy ( )
66
+ expect ( result . isEndOfSurah ) . toBeFalsy ( )
67
+ expect ( result . isEndOfPage ) . toBeFalsy ( )
68
+ expect ( result . isEndOfJuz ) . toBeFalsy ( )
69
+ expect ( result . isEndOfRuku ) . toBeFalsy ( )
70
+ expect ( result . isStartOfRuku ) . toBeTruthy ( )
71
+ expect ( result . ruku ) . toBe ( 3 )
37
72
expect ( result . isSajdahAyah ) . toBeFalsy ( )
38
73
} )
39
74
@@ -46,16 +81,19 @@ describe("ayahMeta", () => {
46
81
expect ( result . isEndOfPage ) . toBeTruthy ( )
47
82
expect ( result . isEndOfJuz ) . toBeTruthy ( )
48
83
expect ( result . isSajdahAyah ) . toBeFalsy ( )
84
+ expect ( result . isEndOfRuku ) . toBeTruthy ( )
85
+ expect ( result . isEndOfQuarter ) . toBeTruthy ( )
86
+ expect ( result . ruku ) . toBe ( meta . numRukus )
49
87
} )
50
88
51
89
it ( "1160 is SajdahAyah" , ( ) => {
52
90
const result = getAyahMeta ( 1160 )
53
91
expect ( result . isSajdahAyah ) . toBeTruthy ( )
54
92
} )
55
93
56
- it ( "1160 is SajdahAyah" , ( ) => {
57
- const result = getAyahMeta ( 1160 )
58
- expect ( result . isSajdahAyah ) . toBeTruthy ( )
94
+ it ( "1161 is not SajdahAyah" , ( ) => {
95
+ const result = getAyahMeta ( 1161 )
96
+ expect ( result . isSajdahAyah ) . toBeFalsy ( )
59
97
} )
60
98
61
99
it ( "should throw RangeError for ayah number below 1" , ( ) => {
@@ -65,4 +103,13 @@ describe("ayahMeta", () => {
65
103
it ( "should throw RangeError for ayah number above numAyahs" , ( ) => {
66
104
expect ( ( ) => getAyahMeta ( meta . numAyahs + 1 ) ) . toThrow ( RangeError )
67
105
} )
106
+
107
+
108
+ it ( "should return correct metadata for ayah 6235" , ( ) => {
109
+ const result = getAyahMeta ( 6235 )
110
+ expect ( result . isStartOfRuku ) . toBeFalsy ( )
111
+ expect ( result . isEndOfRuku ) . toBeFalsy ( )
112
+ expect ( result . isEndOfQuarter ) . toBeFalsy ( )
113
+ expect ( result . ruku ) . toBe ( meta . numRukus )
114
+ } )
68
115
} )
0 commit comments