mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 03:05:51 +03:00
Add tests for was verified case
This commit is contained in:
parent
b53b5cc45d
commit
520b4c3e65
1 changed files with 15 additions and 3 deletions
|
@ -6,7 +6,7 @@ function mkClient(selfTrust) {
|
|||
getUserId: () => "@self:localhost",
|
||||
checkUserTrust: (userId) => ({
|
||||
isCrossSigningVerified: () => userId[1] == "T",
|
||||
wasCrossSigningVerified: () => userId[1] == "T",
|
||||
wasCrossSigningVerified: () => userId[1] == "T" || userId[1] == "W",
|
||||
}),
|
||||
checkDeviceTrust: (userId, deviceId) => ({
|
||||
isVerified: () => userId === "@self:localhost" ? selfTrust : userId[2] == "T",
|
||||
|
@ -151,7 +151,7 @@ describe("shieldStatusForMembership other-trust behaviour", function() {
|
|||
const client = mkClient(true);
|
||||
const room = {
|
||||
roomId: dm ? "DM" : "other",
|
||||
getEncryptionTargetMembers: () => ["@self:localhost", "@TF:h", "@TT: h"].map((userId) => ({userId})),
|
||||
getEncryptionTargetMembers: () => ["@self:localhost", "@TF:h", "@TT:h"].map((userId) => ({userId})),
|
||||
};
|
||||
const status = await shieldStatusForRoom(client, room);
|
||||
expect(status).toEqual(result);
|
||||
|
@ -163,7 +163,19 @@ describe("shieldStatusForMembership other-trust behaviour", function() {
|
|||
const client = mkClient(true);
|
||||
const room = {
|
||||
roomId: dm ? "DM" : "other",
|
||||
getEncryptionTargetMembers: () => ["@self:localhost", "@FF:h", "@FT: h"].map((userId) => ({userId})),
|
||||
getEncryptionTargetMembers: () => ["@self:localhost", "@FF:h", "@FT:h"].map((userId) => ({userId})),
|
||||
};
|
||||
const status = await shieldStatusForRoom(client, room);
|
||||
expect(status).toEqual(result);
|
||||
});
|
||||
|
||||
it.each(
|
||||
[["warning", true], ["warning", false]],
|
||||
)("2 was verified: returns '%s', DM = %s", async (result, dm) => {
|
||||
const client = mkClient(true);
|
||||
const room = {
|
||||
roomId: dm ? "DM" : "other",
|
||||
getEncryptionTargetMembers: () => ["@self:localhost", "@WF:h", "@FT:h"].map((userId) => ({userId})),
|
||||
};
|
||||
const status = await shieldStatusForRoom(client, room);
|
||||
expect(status).toEqual(result);
|
||||
|
|
Loading…
Reference in a new issue