Optimise Jest run in CI (#9542)

This commit is contained in:
Michael Telatynski 2022-11-04 10:48:08 +00:00 committed by GitHub
parent 28ecdc0cb4
commit 04bc8fb71c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 1388 additions and 1305 deletions

View file

@ -153,7 +153,7 @@ describe("VoiceBroadcastPlayback", () => {
},
);
mocked(MediaEventHelper).mockImplementation((event: MatrixEvent) => {
mocked(MediaEventHelper).mockImplementation((event: MatrixEvent): any => {
if (event === chunk1Event) return chunk1Helper;
if (event === chunk2Event) return chunk2Helper;
if (event === chunk3Event) return chunk3Helper;

View file

@ -130,15 +130,13 @@ describe("VoiceBroadcastRecording", () => {
mocked(createVoiceBroadcastRecorder).mockReturnValue(voiceBroadcastRecorder);
onChunkRecorded = jest.fn();
mocked(voiceBroadcastRecorder.on).mockImplementation(
(event: VoiceBroadcastRecorderEvent, listener: any): VoiceBroadcastRecorder => {
if (event === VoiceBroadcastRecorderEvent.ChunkRecorded) {
onChunkRecorded = listener;
}
mocked(voiceBroadcastRecorder.on).mockImplementation((event: any, listener: any): VoiceBroadcastRecorder => {
if (event === VoiceBroadcastRecorderEvent.ChunkRecorded) {
onChunkRecorded = listener;
}
return voiceBroadcastRecorder;
},
);
return voiceBroadcastRecorder;
});
mocked(uploadFile).mockResolvedValue({
url: uploadedUrl,

View file

@ -2,10 +2,10 @@
exports[`startNewVoiceBroadcastRecording when the current user is allowed to send voice broadcast info state events when there already is a live broadcast of another user should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one.
</p>,
@ -14,8 +14,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -25,10 +25,10 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
exports[`startNewVoiceBroadcastRecording when the current user is allowed to send voice broadcast info state events when there already is a live broadcast of the current user in the room should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.
</p>,
@ -37,8 +37,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -48,10 +48,10 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
exports[`startNewVoiceBroadcastRecording when the current user is allowed to send voice broadcast info state events when there is already a current voice broadcast should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.
</p>,
@ -60,8 +60,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},
@ -71,10 +71,10 @@ exports[`startNewVoiceBroadcastRecording when the current user is allowed to sen
exports[`startNewVoiceBroadcastRecording when the current user is not allowed to send voice broadcast info state events should show an info dialog 1`] = `
[MockFunction] {
"calls": Array [
Array [
"calls": [
[
[Function],
Object {
{
"description": <p>
You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions.
</p>,
@ -83,8 +83,8 @@ exports[`startNewVoiceBroadcastRecording when the current user is not allowed to
},
],
],
"results": Array [
Object {
"results": [
{
"type": "return",
"value": undefined,
},

View file

@ -88,7 +88,7 @@ describe("startNewVoiceBroadcastRecording", () => {
mocked(VoiceBroadcastRecording).mockImplementation((
infoEvent: MatrixEvent,
client: MatrixClient,
) => {
): any => {
return {
infoEvent,
client,