Fix soft crash around unknown room pills (#9301)

* Fix soft crash around unknown room pills

* Add tests

* Fix types
This commit is contained in:
Michael Telatynski 2022-09-20 18:00:31 +01:00 committed by GitHub
parent 7e435eef13
commit fa2ec7f6c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -15,6 +15,7 @@ limitations under the License.
*/
import { EmojiPart, PlainPart } from "../../src/editor/parts";
import { createPartCreator } from "./mock";
describe("editor/parts", () => {
describe("appendUntilRejected", () => {
@ -32,4 +33,10 @@ describe("editor/parts", () => {
expect(part.text).toEqual(femaleFacepalmEmoji);
});
});
it("should not explode on room pills for unknown rooms", () => {
const pc = createPartCreator();
const part = pc.roomPill("#room:server");
expect(() => part.toDOMNode()).not.toThrow();
});
});