Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add support for the text_indopak_nastaleeq field. #24

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ export const handlers = [
rub_number: 1,
sajdah_type: null,
sajdah_number: null,
text_indopak_nastaleeq:
'بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِیْمِ ۟',
words: [
{
id: 1,
Expand Down
1 change: 1 addition & 0 deletions src/types/api/Verse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Verse {
textImlaei?: string;
textImlaeiSimple?: string;
textIndopak?: string;
textIndopakNastaleeq?: string;
sajdahNumber: null;
// sajdahType: null;
imageUrl?: string;
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export type VerseField =
| 'textImlaei'
| 'textImlaeiSimple'
| 'textIndopak'
| 'textIndopakNastaleeq'
| 'textUthmaniTajweed'
| 'imageUrl'
| 'imageWidth'
Expand Down
28 changes: 28 additions & 0 deletions test/verses.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { expect, it, vi } from 'vitest';
import { createApiTest } from './utils';
import * as internalFetcher from '../src/sdk/v4/_fetcher';

createApiTest('verses', {
findByChapter: {
Expand All @@ -7,6 +9,32 @@ createApiTest('verses', {
},
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: {
Expand Down