Skip to content

Commit

Permalink
refactor: trascriptXblockV2 to transcriptXblockV2 in urls
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Jan 29, 2025
1 parent 9f74c07 commit 4961e73
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/editors/data/services/cms/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jest.mock('./urls', () => ({
({ studioEndpointUrl, learningContextId }) => `${studioEndpointUrl}/some_video_upload_url/${learningContextId}`,
),
handlerUrl: jest.fn().mockReturnValue('urls.handlerUrl'),
trascriptXblockV2: jest.fn().mockReturnValue('url.transcriptXblockV2'),
transcriptXblockV2: jest.fn().mockReturnValue('url.transcriptXblockV2'),
}));

jest.mock('./utils', () => ({
Expand Down Expand Up @@ -436,7 +436,7 @@ describe('cms api', () => {
language,
});
expect(post).toHaveBeenCalledWith(
urls.trascriptXblockV2({ transcriptHandlerUrl }),
urls.transcriptXblockV2({ transcriptHandlerUrl }),
mockFormdata,
);
});
Expand All @@ -455,7 +455,7 @@ describe('cms api', () => {
mockDeleteJSON,
);
});
it('should call deleteObject with urls.trascriptXblockV2 and transcript data', () => {
it('should call deleteObject with urls.transcriptXblockV2 and transcript data', () => {
const mockDeleteJSON = { data: { lang: language, edx_video_id: videoId } };
const transcriptHandlerUrl = 'handlerUrl';
apiMethods.deleteTranscriptV2({
Expand All @@ -464,7 +464,7 @@ describe('cms api', () => {
language,
});
expect(deleteObject).toHaveBeenCalledWith(
urls.trascriptXblockV2({ transcriptHandlerUrl }),
urls.transcriptXblockV2({ transcriptHandlerUrl }),
mockDeleteJSON,
);
});
Expand All @@ -483,7 +483,7 @@ describe('cms api', () => {
mockJSON,
);
});
it('should call get with urls.trascriptXblockV2 and transcript data', () => {
it('should call get with urls.transcriptXblockV2 and transcript data', () => {
const mockJSON = { data: { lang: language, edx_video_id: videoId } };
const transcriptHandlerUrl = 'handlerUrl';
apiMethods.getTranscriptV2({
Expand All @@ -492,7 +492,7 @@ describe('cms api', () => {
language,
});
expect(get).toHaveBeenCalledWith(
`${urls.trascriptXblockV2({ transcriptHandlerUrl })}?language_code=${language}`,
`${urls.transcriptXblockV2({ transcriptHandlerUrl })}?language_code=${language}`,
mockJSON,
);
});
Expand Down
6 changes: 3 additions & 3 deletions src/editors/data/services/cms/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const apiMethods = {
}) => {
const getJSON = { data: { lang: language, edx_video_id: videoId } };
return get(
`${urls.trascriptXblockV2({ transcriptHandlerUrl: handlerUrl })}?language_code=${language}`,
`${urls.transcriptXblockV2({ transcriptHandlerUrl: handlerUrl })}?language_code=${language}`,
getJSON,
);
},
Expand All @@ -245,7 +245,7 @@ export const apiMethods = {
}) => {
const deleteJSON = { data: { lang: language, edx_video_id: videoId } };
return deleteObject(
urls.trascriptXblockV2({ transcriptHandlerUrl: handlerUrl }),
urls.transcriptXblockV2({ transcriptHandlerUrl: handlerUrl }),
deleteJSON,
);
},
Expand Down Expand Up @@ -280,7 +280,7 @@ export const apiMethods = {
data.append('language_code', language);
data.append('new_language_code', newLanguage || language);
return post(
urls.trascriptXblockV2({ transcriptHandlerUrl: handlerUrl }),
urls.transcriptXblockV2({ transcriptHandlerUrl: handlerUrl }),
data,
);
},
Expand Down
6 changes: 3 additions & 3 deletions src/editors/data/services/cms/urls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
videoFeatures,
courseVideos,
handlerUrl,
trascriptXblockV2,
transcriptXblockV2,
downloadVideoTranscriptURLV2,
} from './urls';

Expand Down Expand Up @@ -200,9 +200,9 @@ describe('cms url methods', () => {
.toEqual(`${studioEndpointUrl}/api/xblock/v2/xblocks/${blockId}/handler_url/transcript/`);
});
});
describe('trascriptXblockV2', () => {
describe('transcriptXblockV2', () => {
it('returns url with transcriptHandlerUrl', () => {
expect(trascriptXblockV2({ transcriptHandlerUrl }))
expect(transcriptXblockV2({ transcriptHandlerUrl }))
.toEqual(`${transcriptHandlerUrl}translation`);
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/editors/data/services/cms/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ export const downloadVideoTranscriptURL = (({ studioEndpointUrl, blockId, langua
`${videoTranscripts({ studioEndpointUrl, blockId })}?language_code=${language}`
)) satisfies UrlFunction;

export const trascriptXblockV2 = (({ transcriptHandlerUrl }) => (
export const transcriptXblockV2 = (({ transcriptHandlerUrl }) => (
`${transcriptHandlerUrl}translation`
)) satisfies UrlFunction;

export const downloadVideoTranscriptURLV2 = (({ transcriptHandlerUrl, language }) => (
`${trascriptXblockV2({ transcriptHandlerUrl })}?language_code=${language}`
`${transcriptXblockV2({ transcriptHandlerUrl })}?language_code=${language}`
)) satisfies UrlFunction;

export const mediaTranscriptURL = (({ studioEndpointUrl, transcriptUrl }) => (
Expand Down

0 comments on commit 4961e73

Please sign in to comment.