Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
PrantaDas committed Aug 7, 2024
1 parent 04069dc commit 0400108
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 22 deletions.
3 changes: 1 addition & 2 deletions src/apis/audio.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import audio from "./audio";

import { audio } from "./audio";

describe("Fetch Chapters Audio of a Reciter", () => {

Expand Down
3 changes: 1 addition & 2 deletions src/apis/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<IAudio | Error | AxiosError> {
if (!id || !chapter_number)
Expand Down Expand Up @@ -133,4 +133,3 @@ const audio: AudioApi = {

};

export default audio;
2 changes: 1 addition & 1 deletion src/apis/chapter.test.ts
Original file line number Diff line number Diff line change
@@ -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());
Expand Down
3 changes: 1 addition & 2 deletions src/apis/chapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { handleError, handleResponse } from "../utils";
const api = Api();


const chapter: ChapterApi = {
export const chapter: ChapterApi = {
listChapters(language = 'en'): Promise<ListChapters | Error | AxiosError> {
const isLanguageSupported = language && ALLOWED_LANGUAGES.has(language);
if (!isLanguageSupported) return Promise.reject(new Error("Provided language is not supported"));
Expand Down Expand Up @@ -34,4 +34,3 @@ const chapter: ChapterApi = {
}
};

export default chapter;
6 changes: 6 additions & 0 deletions src/apis/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './audio';
export * from './chapter';
export * from './juz';
export * from './quran';
export * from './resource';
export * from './verse';
4 changes: 1 addition & 3 deletions src/apis/juz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { handleError, handleResponse } from "../utils";

const api = Api();

const juz: JuzApi = {
export const juz: JuzApi = {
getAllJuzs(): Promise<JuzResponse | Error | AxiosError> {
return new Promise((resolve, reject) => {
api.get('/juzs')
Expand All @@ -14,5 +14,3 @@ const juz: JuzApi = {
});
},
};

export default juz;
2 changes: 1 addition & 1 deletion src/apis/quran.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import quran from "./quran";
import { quran } from "./quran";

describe("Testing the Quran APIs", () => {

Expand Down
4 changes: 1 addition & 3 deletions src/apis/quran.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { handleError, handleResponse } from "../utils";

const api = Api();

const quran: QuranApi = {
export const quran: QuranApi = {
getIndoPakScriptOfAyah(query?: QuranQuery): Promise<QuranResponse | AxiosError | Error> {
const uri = query ? `/quran/verses/code_v1?${new URLSearchParams(query as URLSearchParams)}` : '/quran/verses/code_v1';
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -88,5 +88,3 @@ const quran: QuranApi = {
});
},
};

export default quran;
2 changes: 1 addition & 1 deletion src/apis/resource.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import resources from "./resource";
import { resources } from "./resource";

describe("Fetching the recitation by id", () => {
beforeEach(() => jest.clearAllMocks());
Expand Down
4 changes: 1 addition & 3 deletions src/apis/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { handleError, handleResponse } from "../utils";
const api = Api();


const resources: ResourceApi = {
export const resources: ResourceApi = {
getRecitationInfo(recitation_id: string): Promise<RecitaionInfo | Error | AxiosError> {
if (!recitation_id) return Promise.reject(new Error('Recitation ID is required'));
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -78,5 +78,3 @@ const resources: ResourceApi = {
});
}
};

export default resources;
2 changes: 1 addition & 1 deletion src/apis/verse.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import verse from './verse';
import { verse } from "./verse";

describe("Fetching verses by chapter number", () => {
beforeEach(() => jest.clearAllMocks());
Expand Down
4 changes: 1 addition & 3 deletions src/apis/verse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<VerseResponse | AxiosError | Error> {
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}`;
Expand Down Expand Up @@ -70,5 +70,3 @@ const verse: VerseApi = {
});
},
};

export default verse;
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';

0 comments on commit 0400108

Please sign in to comment.