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

Fix type errors in videoSlice.test.ts #907

Merged
merged 2 commits into from
Nov 23, 2022
Merged
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: 1 addition & 1 deletion src/main/SubtitleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const SubtitleAddButton: React.FC<{languages: {subFlavor: string, title: string}
*/}
<ThemeProvider theme={muiTheme}>
<Select
label={t("subtitles.createSubtitleDropdown-label")}
label={t("subtitles.createSubtitleDropdown-label") ?? undefined}
name="languages"
data={selectData()}
>
Expand Down
2 changes: 1 addition & 1 deletion src/main/SubtitleVideoArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const VideoSelectDropdown : React.FC<{

<ThemeProvider theme={muiTheme}>
<Select
label={t("subtitleVideoArea.selectVideoLabel")}
label={t("subtitleVideoArea.selectVideoLabel") ?? undefined}
name={dropdownName}
data={selectData()}
/>
Expand Down
12 changes: 7 additions & 5 deletions src/redux/__tests__/videoSlice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ describe('Video reducer', () => {
it('should set loading when fetch is pending', () => {
// Arrange
const action = { type: fetchVideoInformation.pending.type };
const resultStatus: httpRequestState = { status: 'loading', error: undefined }
const resultStatus: httpRequestState = { status: 'loading', error: undefined, errorReason: "unknown" }

// Act
const nextState = reducer(initialState, action);
Expand All @@ -298,16 +298,18 @@ describe('Video reducer', () => {

it('should set success when fetch is successful', () => {
// Arrange
const resultStatus: httpRequestState = { status: 'success', error: undefined }
const resultStatus: httpRequestState = { status: 'success', error: undefined, errorReason: "unknown" }
const segments = [{ start: 0, end: 42, deleted: false }]
const videoURLs: video["videoURLs"] = [ "video/url" ]
const dur: video["duration"] = 42
const title: video["title"] = "Video Title"
// const presenters: video["presenters"] = [ "Otto Opencast" ] // Currently missing from the API
const tracks: video["tracks"] = [{
id: "id", uri: videoURLs[0], flavor: { subtype: "prepared", type: "presenter"},
videoStream: { available: true, enabled: true, thumbnail_uri: "thumb/url"},
audioStream: { available: true, enabled: true}
video_stream: { available: true, enabled: true, thumbnail_uri: "thumb/url"},
audio_stream: { available: true, enabled: true, thumbnail_uri: "thumb/url"},
thumbnailUri: undefined,
thumbnailPriority: 0,
}]
const workflows: video["workflows"] = [{ id: "id", name: "Name", displayOrder: 0, description: "Description"}]
const action = {
Expand Down Expand Up @@ -341,7 +343,7 @@ describe('Video reducer', () => {
// Arrange
const error = { message: "An error message" }
const action = { type: fetchVideoInformation.rejected.type, error: error };
const resultStatus: httpRequestState = { status: 'failed', error: error.message }
const resultStatus: httpRequestState = { status: 'failed', error: error.message, errorReason: "unknown" }

// Act
const nextState = reducer(initialState, action);
Expand Down