Apply strictNullChecks around the codebase (#10302

* Apply `strictNullChecks` around the codebase

* Iterate PR
This commit is contained in:
Michael Telatynski 2023-03-07 13:19:18 +00:00 committed by GitHub
parent 7c2bb966d0
commit 4b8bada24b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 112 additions and 77 deletions

View file

@ -412,9 +412,9 @@ describe("Spotlight Dialog", () => {
jest.advanceTimersByTime(200);
await flushPromisesWithFakeTimers();
expect(screen.getByText(potatoRoom.name)).toBeInTheDocument();
expect(screen.queryByText(nsfwTopicRoom.name)).not.toBeInTheDocument();
expect(screen.queryByText(nsfwTopicRoom.name)).not.toBeInTheDocument();
expect(screen.getByText(potatoRoom.name!)).toBeInTheDocument();
expect(screen.queryByText(nsfwTopicRoom.name!)).not.toBeInTheDocument();
expect(screen.queryByText(nsfwTopicRoom.name!)).not.toBeInTheDocument();
});
it("displays rooms with nsfw keywords in results when showNsfwPublicRooms is truthy", async () => {
@ -425,9 +425,9 @@ describe("Spotlight Dialog", () => {
jest.advanceTimersByTime(200);
await flushPromisesWithFakeTimers();
expect(screen.getByText(nsfwTopicRoom.name)).toBeInTheDocument();
expect(screen.getByText(nsfwNameRoom.name)).toBeInTheDocument();
expect(screen.getByText(potatoRoom.name)).toBeInTheDocument();
expect(screen.getByText(nsfwTopicRoom.name!)).toBeInTheDocument();
expect(screen.getByText(nsfwNameRoom.name!)).toBeInTheDocument();
expect(screen.getByText(potatoRoom.name!)).toBeInTheDocument();
});
});
});

View file

@ -328,7 +328,7 @@ describe("<DeviceItem />", () => {
it("with unverified user and device, displays button without a label", () => {
renderComponent();
expect(screen.getByRole("button", { name: device.getDisplayName() })).toBeInTheDocument;
expect(screen.getByRole("button", { name: device.getDisplayName()! })).toBeInTheDocument;
expect(screen.queryByText(/trusted/i)).not.toBeInTheDocument();
});
@ -343,7 +343,7 @@ describe("<DeviceItem />", () => {
setMockDeviceTrust(true);
renderComponent();
expect(screen.getByText(device.getDisplayName())).toBeInTheDocument();
expect(screen.getByText(device.getDisplayName()!)).toBeInTheDocument();
expect(screen.queryByText(/trusted/)).not.toBeInTheDocument();
});
@ -356,7 +356,7 @@ describe("<DeviceItem />", () => {
// expect to see no button in this case
expect(screen.queryByRole("button")).not.toBeInTheDocument;
expect(screen.getByText(device.getDisplayName())).toBeInTheDocument();
expect(screen.getByText(device.getDisplayName()!)).toBeInTheDocument();
});
it("with verified user and device, displays no button and a 'Trusted' label", () => {
@ -365,7 +365,7 @@ describe("<DeviceItem />", () => {
renderComponent();
expect(screen.queryByRole("button")).not.toBeInTheDocument;
expect(screen.getByText(device.getDisplayName())).toBeInTheDocument();
expect(screen.getByText(device.getDisplayName()!)).toBeInTheDocument();
expect(screen.getByText("Trusted")).toBeInTheDocument();
});
@ -373,7 +373,7 @@ describe("<DeviceItem />", () => {
mockClient.getUser.mockReturnValueOnce(null);
renderComponent();
const button = screen.getByRole("button", { name: device.getDisplayName() });
const button = screen.getByRole("button", { name: device.getDisplayName()! });
expect(button).toBeInTheDocument;
await userEvent.click(button);
@ -387,7 +387,7 @@ describe("<DeviceItem />", () => {
mockClient.isGuest.mockReturnValueOnce(true);
renderComponent();
const button = screen.getByRole("button", { name: device.getDisplayName() });
const button = screen.getByRole("button", { name: device.getDisplayName()! });
expect(button).toBeInTheDocument;
await userEvent.click(button);