Very bit test overhaul. All displayname tests are now done in the

Metadata file. and not in the CallViewModel anymore.
This commit is contained in:
Timo K
2025-11-11 15:52:35 +01:00
parent 85f659bcc9
commit 8671d3fd67
13 changed files with 806 additions and 630 deletions

View File

@@ -6,10 +6,10 @@ Please see LICENSE in the repository root for full details.
*/
import { afterEach, beforeAll, describe, expect, test, vi } from "vitest";
import { type RoomMember } from "matrix-js-sdk";
import { shouldDisambiguate } from "./displayname";
import { alice } from "./test-fixtures";
import { mockMatrixRoom } from "./test";
// Ideally these tests would be in ./displayname.test.ts but I can't figure out how to
// just spy on the removeHiddenChars() function without impacting the other tests.
@@ -29,7 +29,7 @@ describe("shouldDisambiguate", () => {
});
test("should only call removeHiddenChars once for a single displayname", () => {
const room = mockMatrixRoom({});
const room: Map<string, Pick<RoomMember, "userId">> = new Map([]);
shouldDisambiguate(alice, [], room);
expect(jsUtils.removeHiddenChars).toHaveBeenCalledTimes(1);
for (let i = 0; i < 10; i++) {