Conform more of the codebase to strictNullChecks (#10602)

* Conform more of the codebase to `strictNullChecks`

* Conform more of the codebase to `strictNullChecks`

* Fix types
This commit is contained in:
Michael Telatynski 2023-04-17 08:31:58 +01:00 committed by GitHub
parent 93858813a3
commit daad630827
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 79 additions and 49 deletions

View file

@ -24,8 +24,20 @@ import { AutocompleteInput } from "../../../src/components/structures/Autocomple
describe("AutocompleteInput", () => {
const mockCompletion: ICompletion[] = [
{ type: "user", completion: "user_1", completionId: "@user_1:host.local", range: { start: 1, end: 1 } },
{ type: "user", completion: "user_2", completionId: "@user_2:host.local", range: { start: 1, end: 1 } },
{
type: "user",
completion: "user_1",
completionId: "@user_1:host.local",
range: { start: 1, end: 1 },
component: <div />,
},
{
type: "user",
completion: "user_2",
completionId: "@user_2:host.local",
range: { start: 1, end: 1 },
component: <div />,
},
];
const constructMockProvider = (data: ICompletion[]) =>

View file

@ -15,6 +15,7 @@ limitations under the License.
*/
import { mocked } from "jest-mock";
import React from "react";
import { ICompletion } from "../../../../../../src/autocomplete/Autocompleter";
import {
@ -34,6 +35,7 @@ const createMockCompletion = (props: Partial<ICompletion>): ICompletion => {
return {
completion: "mock",
range: { beginning: true, start: 0, end: 0 },
component: React.createElement("div"),
...props,
};
};

View file

@ -32,9 +32,21 @@ import { ICompletion } from "../../../../src/autocomplete/Autocompleter";
jest.mock("../../../../src/autocomplete/UserProvider");
const completions: ICompletion[] = [
{ type: "user", completion: "user_1", completionId: "@user_1:host.local", range: { start: 1, end: 1 } },
{ type: "user", completion: "user_2", completionId: "@user_2:host.local", range: { start: 1, end: 1 } },
{ type: "user", completion: "user_without_completion_id", range: { start: 1, end: 1 } },
{
component: <div />,
type: "user",
completion: "user_1",
completionId: "@user_1:host.local",
range: { start: 1, end: 1 },
},
{
component: <div />,
type: "user",
completion: "user_2",
completionId: "@user_2:host.local",
range: { start: 1, end: 1 },
},
{ component: <div />, type: "user", completion: "user_without_completion_id", range: { start: 1, end: 1 } },
];
describe("<AddPrivilegedUsers />", () => {