Skip to content

Commit

Permalink
feat: add indopak_nastaleeq text
Browse files Browse the repository at this point in the history
The SDK currently does not support the text_indopak_nastaleeq field. This field, instead of the text_indopak, is useful when the using the nastaleeq font as it correctly provides each verse's end characters.
  • Loading branch information
hkamran2 committed Feb 26, 2025
1 parent 07a6b5b commit 13a85ec
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
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

0 comments on commit 13a85ec

Please sign in to comment.