mirror of https://github.com/vector-im/riot-web
Improve strict typing
parent
cb4e444a60
commit
b79912e390
|
@ -107,8 +107,8 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
|
||||||
modal.hidden = !modal.hidden;
|
modal.hidden = !modal.hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
public hasDialogs() {
|
public hasDialogs(): boolean {
|
||||||
return this.priorityModal || this.staticModal || this.modals.length > 0;
|
return !!(this.priorityModal || this.staticModal || this.modals.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createDialog<T extends any[]>(
|
public createDialog<T extends any[]>(
|
||||||
|
|
|
@ -112,11 +112,11 @@ describe("Notifier", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
mockClient.pushRules = {
|
mockClient.pushRules = {
|
||||||
global: undefined,
|
global: {},
|
||||||
};
|
};
|
||||||
accountDataEventKey = getLocalNotificationAccountDataEventType(mockClient.deviceId);
|
accountDataEventKey = getLocalNotificationAccountDataEventType(mockClient.deviceId!);
|
||||||
|
|
||||||
testRoom = new Room(roomId, mockClient, mockClient.getUserId());
|
testRoom = new Room(roomId, mockClient, mockClient.getSafeUserId());
|
||||||
|
|
||||||
MockPlatform = mockPlatformPeg({
|
MockPlatform = mockPlatformPeg({
|
||||||
supportsNotifications: jest.fn().mockReturnValue(true),
|
supportsNotifications: jest.fn().mockReturnValue(true),
|
||||||
|
@ -127,8 +127,10 @@ describe("Notifier", () => {
|
||||||
|
|
||||||
Notifier.isBodyEnabled = jest.fn().mockReturnValue(true);
|
Notifier.isBodyEnabled = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
mockClient.getRoom.mockImplementation((id) => {
|
mockClient.getRoom.mockImplementation((id: string | undefined): Room | null => {
|
||||||
return id === roomId ? testRoom : new Room(id, mockClient, mockClient.getUserId());
|
if (id === roomId) return testRoom;
|
||||||
|
if (id) return new Room(id, mockClient, mockClient.getSafeUserId());
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -484,7 +486,7 @@ describe("Notifier", () => {
|
||||||
|
|
||||||
dis.dispatch<ThreadPayload>({
|
dis.dispatch<ThreadPayload>({
|
||||||
action: Action.ViewThread,
|
action: Action.ViewThread,
|
||||||
thread_id: rootEvent.getId(),
|
thread_id: rootEvent.getId()!,
|
||||||
});
|
});
|
||||||
|
|
||||||
await waitFor(() => expect(SdkContextClass.instance.roomViewStore.getThreadId()).toBe(rootEvent.getId()));
|
await waitFor(() => expect(SdkContextClass.instance.roomViewStore.getThreadId()).toBe(rootEvent.getId()));
|
||||||
|
|
Loading…
Reference in New Issue