From 04001087d665c4ea38085ad123b9dfc0547cb2d6 Mon Sep 17 00:00:00 2001 From: Prantadas Date: Wed, 7 Aug 2024 12:48:11 +0600 Subject: [PATCH] cleanup --- src/apis/audio.test.ts | 3 +-- src/apis/audio.ts | 3 +-- src/apis/chapter.test.ts | 2 +- src/apis/chapter.ts | 3 +-- src/apis/index.ts | 6 ++++++ src/apis/juz.ts | 4 +--- src/apis/quran.test.ts | 2 +- src/apis/quran.ts | 4 +--- src/apis/resource.test.ts | 2 +- src/apis/resource.ts | 4 +--- src/apis/verse.test.ts | 2 +- src/apis/verse.ts | 4 +--- src/index.ts | 2 ++ 13 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/apis/audio.test.ts b/src/apis/audio.test.ts index e67d646..7675849 100644 --- a/src/apis/audio.test.ts +++ b/src/apis/audio.test.ts @@ -1,5 +1,4 @@ -import audio from "./audio"; - +import { audio } from "./audio"; describe("Fetch Chapters Audio of a Reciter", () => { diff --git a/src/apis/audio.ts b/src/apis/audio.ts index 9a57128..b72cb1c 100644 --- a/src/apis/audio.ts +++ b/src/apis/audio.ts @@ -13,7 +13,7 @@ import { handleError, handleResponse } from "../utils"; const api = Api(); -const audio: AudioApi = { +export const audio: AudioApi = { getChaptersAudioOfAReciter(id: number, chapter_number: number): Promise { if (!id || !chapter_number) @@ -133,4 +133,3 @@ const audio: AudioApi = { }; -export default audio; \ No newline at end of file diff --git a/src/apis/chapter.test.ts b/src/apis/chapter.test.ts index 4956116..bc6e545 100644 --- a/src/apis/chapter.test.ts +++ b/src/apis/chapter.test.ts @@ -1,5 +1,5 @@ import { ListChapters } from "../types"; -import chapter from "./chapter"; +import { chapter } from "./chapter"; describe("Fetch all the chapter according to language", () => { beforeEach(() => jest.clearAllMocks()); diff --git a/src/apis/chapter.ts b/src/apis/chapter.ts index fcd4f0d..28b7164 100644 --- a/src/apis/chapter.ts +++ b/src/apis/chapter.ts @@ -6,7 +6,7 @@ import { handleError, handleResponse } from "../utils"; const api = Api(); -const chapter: ChapterApi = { +export const chapter: ChapterApi = { listChapters(language = 'en'): Promise { const isLanguageSupported = language && ALLOWED_LANGUAGES.has(language); if (!isLanguageSupported) return Promise.reject(new Error("Provided language is not supported")); @@ -34,4 +34,3 @@ const chapter: ChapterApi = { } }; -export default chapter; \ No newline at end of file diff --git a/src/apis/index.ts b/src/apis/index.ts index e69de29..9323e0b 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -0,0 +1,6 @@ +export * from './audio'; +export * from './chapter'; +export * from './juz'; +export * from './quran'; +export * from './resource'; +export * from './verse'; \ No newline at end of file diff --git a/src/apis/juz.ts b/src/apis/juz.ts index c4479f5..e7baadf 100644 --- a/src/apis/juz.ts +++ b/src/apis/juz.ts @@ -5,7 +5,7 @@ import { handleError, handleResponse } from "../utils"; const api = Api(); -const juz: JuzApi = { +export const juz: JuzApi = { getAllJuzs(): Promise { return new Promise((resolve, reject) => { api.get('/juzs') @@ -14,5 +14,3 @@ const juz: JuzApi = { }); }, }; - -export default juz; \ No newline at end of file diff --git a/src/apis/quran.test.ts b/src/apis/quran.test.ts index 23fa165..8309acf 100644 --- a/src/apis/quran.test.ts +++ b/src/apis/quran.test.ts @@ -1,4 +1,4 @@ -import quran from "./quran"; +import { quran } from "./quran"; describe("Testing the Quran APIs", () => { diff --git a/src/apis/quran.ts b/src/apis/quran.ts index 1d2e981..dc0f01d 100644 --- a/src/apis/quran.ts +++ b/src/apis/quran.ts @@ -14,7 +14,7 @@ import { handleError, handleResponse } from "../utils"; const api = Api(); -const quran: QuranApi = { +export const quran: QuranApi = { getIndoPakScriptOfAyah(query?: QuranQuery): Promise { const uri = query ? `/quran/verses/code_v1?${new URLSearchParams(query as URLSearchParams)}` : '/quran/verses/code_v1'; return new Promise((resolve, reject) => { @@ -88,5 +88,3 @@ const quran: QuranApi = { }); }, }; - -export default quran; \ No newline at end of file diff --git a/src/apis/resource.test.ts b/src/apis/resource.test.ts index d63320c..a245cc5 100644 --- a/src/apis/resource.test.ts +++ b/src/apis/resource.test.ts @@ -1,4 +1,4 @@ -import resources from "./resource"; +import { resources } from "./resource"; describe("Fetching the recitation by id", () => { beforeEach(() => jest.clearAllMocks()); diff --git a/src/apis/resource.ts b/src/apis/resource.ts index 8d165d0..a186832 100644 --- a/src/apis/resource.ts +++ b/src/apis/resource.ts @@ -6,7 +6,7 @@ import { handleError, handleResponse } from "../utils"; const api = Api(); -const resources: ResourceApi = { +export const resources: ResourceApi = { getRecitationInfo(recitation_id: string): Promise { if (!recitation_id) return Promise.reject(new Error('Recitation ID is required')); return new Promise((resolve, reject) => { @@ -78,5 +78,3 @@ const resources: ResourceApi = { }); } }; - -export default resources; \ No newline at end of file diff --git a/src/apis/verse.test.ts b/src/apis/verse.test.ts index 6c1267b..9b778a0 100644 --- a/src/apis/verse.test.ts +++ b/src/apis/verse.test.ts @@ -1,4 +1,4 @@ -import verse from './verse'; +import { verse } from "./verse"; describe("Fetching verses by chapter number", () => { beforeEach(() => jest.clearAllMocks()); diff --git a/src/apis/verse.ts b/src/apis/verse.ts index 552f503..ecb35dc 100644 --- a/src/apis/verse.ts +++ b/src/apis/verse.ts @@ -5,7 +5,7 @@ import { handleError, handleResponse } from "../utils"; const api = Api(); -const verse: VerseApi = { +export const verse: VerseApi = { getVerseByChapter(chapter_number: string, query?: VerseQuery): Promise { if (query?.language && !ALLOWED_LANGUAGES.has(query.language)) throw new Error('Provided query language is not allowed'); const uri = query ? `/verses/by_chapter/${chapter_number}?${new URLSearchParams(query as URLSearchParams)}` : `/verses/by_chapter/${chapter_number}`; @@ -70,5 +70,3 @@ const verse: VerseApi = { }); }, }; - -export default verse; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e69de29..56f9b33 100644 --- a/src/index.ts +++ b/src/index.ts @@ -0,0 +1,2 @@ +export * from './apis'; +export * from './types'; \ No newline at end of file