Make more code conform to strict null checks (#10219
* Make more code conform to strict null checks * Fix types * Fix tests * Fix remaining test assertions * Iterate PR
This commit is contained in:
parent
4c79ecf141
commit
76b82b4b2b
130 changed files with 603 additions and 603 deletions
|
@ -28,7 +28,7 @@ describe("ReadReceiptGroup", () => {
|
|||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie"], true)).toEqual("Alice, Bob, Charlie and more");
|
||||
expect(readReceiptTooltip(["Alice", "Bob"], true)).toEqual("Alice, Bob and more");
|
||||
expect(readReceiptTooltip(["Alice"], true)).toEqual("Alice and more");
|
||||
expect(readReceiptTooltip([], false)).toEqual(null);
|
||||
expect(readReceiptTooltip([], false)).toBeUndefined();
|
||||
});
|
||||
it("returns a pretty list without hasMore", () => {
|
||||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie", "Dan", "Eve"], false)).toEqual(
|
||||
|
@ -40,7 +40,7 @@ describe("ReadReceiptGroup", () => {
|
|||
expect(readReceiptTooltip(["Alice", "Bob", "Charlie"], false)).toEqual("Alice, Bob and Charlie");
|
||||
expect(readReceiptTooltip(["Alice", "Bob"], false)).toEqual("Alice and Bob");
|
||||
expect(readReceiptTooltip(["Alice"], false)).toEqual("Alice");
|
||||
expect(readReceiptTooltip([], false)).toEqual(null);
|
||||
expect(readReceiptTooltip([], false)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
describe("AvatarPosition", () => {
|
||||
|
|
|
@ -281,7 +281,7 @@ describe("<SendMessageComposer/>", () => {
|
|||
|
||||
it("correctly sends a message", () => {
|
||||
mocked(doMaybeLocalRoomAction).mockImplementation(
|
||||
<T extends {}>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
<T,>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
return fn(roomId);
|
||||
},
|
||||
);
|
||||
|
@ -300,7 +300,7 @@ describe("<SendMessageComposer/>", () => {
|
|||
|
||||
it("shows chat effects on message sending", () => {
|
||||
mocked(doMaybeLocalRoomAction).mockImplementation(
|
||||
<T extends {}>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
<T,>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
return fn(roomId);
|
||||
},
|
||||
);
|
||||
|
@ -321,7 +321,7 @@ describe("<SendMessageComposer/>", () => {
|
|||
|
||||
it("not to send chat effects on message sending for threads", () => {
|
||||
mocked(doMaybeLocalRoomAction).mockImplementation(
|
||||
<T extends {}>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
<T,>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
return fn(roomId);
|
||||
},
|
||||
);
|
||||
|
|
|
@ -25,6 +25,7 @@ import { VoiceRecording } from "../../../../src/audio/VoiceRecording";
|
|||
import { doMaybeLocalRoomAction } from "../../../../src/utils/local-room";
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import { IUpload } from "../../../../src/audio/VoiceMessageRecording";
|
||||
import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks";
|
||||
|
||||
jest.mock("../../../../src/utils/local-room", () => ({
|
||||
doMaybeLocalRoomAction: jest.fn(),
|
||||
|
@ -43,10 +44,12 @@ describe("<VoiceRecordComposerTile/>", () => {
|
|||
} as unknown as MatrixClient;
|
||||
MatrixClientPeg.get = () => mockClient;
|
||||
|
||||
const room = {
|
||||
roomId,
|
||||
} as unknown as Room;
|
||||
const props = {
|
||||
room: {
|
||||
roomId,
|
||||
} as unknown as Room,
|
||||
room,
|
||||
permalinkCreator: new RoomPermalinkCreator(room),
|
||||
};
|
||||
mockUpload = {
|
||||
mxc: "mxc://example.com/voice",
|
||||
|
@ -66,7 +69,7 @@ describe("<VoiceRecordComposerTile/>", () => {
|
|||
});
|
||||
|
||||
mocked(doMaybeLocalRoomAction).mockImplementation(
|
||||
<T extends {}>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
<T,>(roomId: string, fn: (actualRoomId: string) => Promise<T>, _client?: MatrixClient) => {
|
||||
return fn(roomId);
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue