Replace uses of checkDeviceTrust
with getDeviceVerificationStatus
(#10663)
matrix-org/matrix-js-sdk#3287 and matrix-org/matrix-js-sdk#3303 added a new API called getDeviceVerificationStatus. Let's use it.
This commit is contained in:
parent
aa8c0f5cc7
commit
d7bb8043ea
22 changed files with 286 additions and 161 deletions
|
@ -30,6 +30,7 @@ import {
|
|||
GroupedArray,
|
||||
concat,
|
||||
asyncEvery,
|
||||
asyncSome,
|
||||
} from "../../src/utils/arrays";
|
||||
|
||||
type TestParams = { input: number[]; output: number[] };
|
||||
|
@ -444,4 +445,27 @@ describe("arrays", () => {
|
|||
expect(predicate).toHaveBeenCalledWith(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("asyncSome", () => {
|
||||
it("when called with an empty array, it should return false", async () => {
|
||||
expect(await asyncSome([], jest.fn().mockResolvedValue(true))).toBe(false);
|
||||
});
|
||||
|
||||
it("when called with some items and the predicate resolves to false for all of them, it should return false", async () => {
|
||||
const predicate = jest.fn().mockResolvedValue(false);
|
||||
expect(await asyncSome([1, 2, 3], predicate)).toBe(false);
|
||||
expect(predicate).toHaveBeenCalledTimes(3);
|
||||
expect(predicate).toHaveBeenCalledWith(1);
|
||||
expect(predicate).toHaveBeenCalledWith(2);
|
||||
expect(predicate).toHaveBeenCalledWith(3);
|
||||
});
|
||||
|
||||
it("when called with some items and the predicate resolves to true, it should short-circuit and return true", async () => {
|
||||
const predicate = jest.fn().mockResolvedValueOnce(false).mockResolvedValueOnce(true);
|
||||
expect(await asyncSome([1, 2, 3], predicate)).toBe(true);
|
||||
expect(predicate).toHaveBeenCalledTimes(2);
|
||||
expect(predicate).toHaveBeenCalledWith(1);
|
||||
expect(predicate).toHaveBeenCalledWith(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue