Skip to content

Commit

Permalink
remove tests related to av1 codec option
Browse files Browse the repository at this point in the history
  • Loading branch information
becky-gilbert committed Jan 30, 2025
1 parent a7d9afe commit 0e6de08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 41 deletions.
9 changes: 0 additions & 9 deletions packages/record/src/recorder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,15 +556,6 @@ test("Initializing a new recorder gets the mime type from the initialization", (
expect(jsPsych.pluginAPI.getCameraRecorder).toHaveBeenCalledTimes(4);
expect(rec_2["mimeType"]).toBe("video/webm;codecs=vp8,opus");

// Initialize with av1
recorder_options = {
mimeType: "video/webm;codecs=av1,opus",
};
jsPsych.pluginAPI.initializeCameraRecorder(stream, recorder_options);
const rec_3 = new Recorder(jsPsych);
expect(jsPsych.pluginAPI.getCameraRecorder).toHaveBeenCalledTimes(6);
expect(rec_3["mimeType"]).toBe("video/webm;codecs=av1,opus");

jsPsych.pluginAPI.initializeCameraRecorder = originalInitializeCameraRecorder;
});

Expand Down
39 changes: 7 additions & 32 deletions packages/record/src/videoConfig.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1196,43 +1196,18 @@ test("Video config getCompatibleMimeType gets correct mime type or null", () =>
const mime_type_2 = video_config["getCompatibleMimeType"]();
expect(mime_type_2).toBe("video/webm;codecs=vp8,opus");

// 3. only supports av1,opus
// 3. supports vp9,opus and vp8,opus, should use the former
// eslint-disable-next-line @typescript-eslint/no-unused-vars
isTypeSupportedSpy.mockImplementation((type) => {
if (type == "video/webm;codecs=av1,opus") {
return true;
} else {
return false;
}
return true;
});
const mime_type_3 = video_config["getCompatibleMimeType"]();
expect(mime_type_3).toBe("video/webm;codecs=av1,opus");
expect(mime_type_3).toBe("video/webm;codecs=vp9,opus");

// 4. supports vp9,opus and av1,opus, should use the former
isTypeSupportedSpy.mockImplementation((type) => {
if (type == "video/webm;codecs=vp8,opus") {
return false;
} else {
return true;
}
});
const mime_type_4 = video_config["getCompatibleMimeType"]();
expect(mime_type_4).toBe("video/webm;codecs=vp9,opus");

// 5. supports vp8,opus and av1,opus, should use the former
isTypeSupportedSpy.mockImplementation((type) => {
if (type == "video/webm;codecs=vp9,opus") {
return false;
} else {
return true;
}
});
const mime_type_5 = video_config["getCompatibleMimeType"]();
expect(mime_type_5).toBe("video/webm;codecs=vp8,opus");

// 6. none supported, should return null
// 4. none supported, should return null
isTypeSupportedSpy.mockImplementation(() => {
return false;
});
const mime_type_6 = video_config["getCompatibleMimeType"]();
expect(mime_type_6).toBeNull();
const mime_type_4 = video_config["getCompatibleMimeType"]();
expect(mime_type_4).toBeNull();
});

0 comments on commit 0e6de08

Please sign in to comment.