Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix all noImplicitAny errors in test-utils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
andybalaam committed Jan 26, 2023
1 parent be69fa6 commit 06f5b99
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/test-utils/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { MediaHandler } from "matrix-js-sdk/src/webrtc/mediaHandler";
import { Feature, ServerSupport } from "matrix-js-sdk/src/feature";
import { CryptoBackend } from "matrix-js-sdk/src/common-crypto/CryptoBackend";
import { IEventDecryptionResult } from "matrix-js-sdk/src/@types/crypto";
import { MapperOpts } from "matrix-js-sdk/src/event-mapper";

import type { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
import { MatrixClientPeg as peg } from "../../src/MatrixClientPeg";
Expand Down Expand Up @@ -145,7 +146,7 @@ export function createTestClient(): MatrixClient {
content: {},
});
}),
mxcUrlToHttp: (mxc) => `http://this.is.a.url/${mxc.substring(6)}`,
mxcUrlToHttp: (mxc: string) => `http://this.is.a.url/${mxc.substring(6)}`,
setAccountData: jest.fn(),
setRoomAccountData: jest.fn(),
setRoomTopic: jest.fn(),
Expand Down Expand Up @@ -200,7 +201,7 @@ export function createTestClient(): MatrixClient {
stopAllStreams: jest.fn(),
} as unknown as MediaHandler),
uploadContent: jest.fn(),
getEventMapper: () => (opts) => new MatrixEvent(opts),
getEventMapper: (_options?: MapperOpts) => (event: Partial<IEvent>) => new MatrixEvent(event),
leaveRoomChain: jest.fn((roomId) => ({ [roomId]: null })),
doesServerSupportLogoutDevices: jest.fn().mockReturnValue(true),
requestPasswordEmailToken: jest.fn().mockRejectedValue({}),
Expand Down Expand Up @@ -476,7 +477,7 @@ export function mkMessage({
}

export function mkStubRoom(roomId: string = null, name: string, client: MatrixClient): Room {
const stubTimeline = { getEvents: () => [] } as unknown as EventTimeline;
const stubTimeline = { getEvents: () => [] as MatrixEvent[] } as unknown as EventTimeline;
return {
canInvite: jest.fn(),
client,
Expand All @@ -497,7 +498,7 @@ export function mkStubRoom(roomId: string = null, name: string, client: MatrixCl
fetchRoomThreads: jest.fn().mockReturnValue(Promise.resolve()),
findEventById: (_: string) => undefined as MatrixEvent | undefined,
findPredecessor: jest.fn().mockReturnValue({ roomId: "", eventId: null }),
getAccountData: (_: EventType | string) => undefined,
getAccountData: (_: EventType | string) => undefined as MatrixEvent | undefined,
getAltAliases: jest.fn().mockReturnValue([]),
getAvatarUrl: () => "mxc://avatar.url/room.png",
getCanonicalAlias: jest.fn(),
Expand Down Expand Up @@ -548,7 +549,7 @@ export function mkStubRoom(roomId: string = null, name: string, client: MatrixCl
} as unknown as Room;
}

export function mkServerConfig(hsUrl, isUrl) {
export function mkServerConfig(hsUrl: string, isUrl: string) {
return makeType(ValidatedServerConfig, {
hsUrl,
hsName: "TEST_ENVIRONMENT",
Expand Down

0 comments on commit 06f5b99

Please sign in to comment.