-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathverses.test.ts
69 lines (65 loc) · 1.54 KB
/
verses.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { expect, it, vi } from 'vitest';
import { createApiTest } from './utils';
import * as internalFetcher from '../src/sdk/v4/_fetcher';
createApiTest('verses', {
findByChapter: {
expect: {
array: true,
},
params: ['1'],
rejectParams: ['0' as any],
customCases: (method) => {
it('should return indopak_nastaleeq text', async () => {
const fetcherSpy = vi.spyOn(internalFetcher, 'fetcher');
const response = await method(1, {
fields: { textIndopakNastaleeq: true },
});
const expectedIndopakNastaleeqText =
'بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِیْمِ ۟';
expect(fetcherSpy).toHaveBeenCalledWith(
'/verses/by_chapter/1',
{
language: 'ar',
perPage: 50,
words: false,
fields: 'text_indopak_nastaleeq',
},
undefined
);
expect(response[0].textIndopakNastaleeq).toBe(
expectedIndopakNastaleeqText
);
});
},
},
findByJuz: {
expect: {
array: true,
},
params: ['1'],
rejectParams: ['0' as any],
},
findByKey: {
params: ['1:1'],
rejectParams: ['0:0' as any],
},
findByPage: {
expect: {
array: true,
},
params: ['1'],
rejectParams: ['0' as any],
},
findRandom: {},
findByHizb: {
expect: {
array: true,
},
params: ['1'],
rejectParams: ['0' as any],
},
findByRub: {
params: ['1'],
rejectParams: ['0' as any],
},
});