1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Add methods to influence set_presence on /sync API calls (#3578)

* Add methods to influence set_presence on /sync API calls

* Tweak comment

* Improve coverage
This commit is contained in:
Michael Telatynski
2023-07-11 14:31:12 +01:00
committed by GitHub
parent 1fdc0af5b7
commit f2471b6dbd
4 changed files with 43 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import { IFilterDefinition } from "../../src/filter";
import { ISearchResults } from "../../src/@types/search";
import { IStore } from "../../src/store";
import { CryptoBackend } from "../../src/common-crypto/CryptoBackend";
import { SetPresence } from "../../src/sync";
describe("MatrixClient", function () {
const userId = "@alice:localhost";
@ -1516,6 +1517,16 @@ describe("MatrixClient", function () {
expect(mockBackend.setTrustCrossSignedDevices).toHaveBeenLastCalledWith(false);
});
});
describe("setSyncPresence", () => {
it("should pass calls through to the underlying sync api", () => {
const setPresence = jest.fn();
// @ts-ignore
client.syncApi = { setPresence };
client?.setSyncPresence(SetPresence.Unavailable);
expect(setPresence).toHaveBeenCalledWith(SetPresence.Unavailable);
});
});
});
function withThreadId(event: MatrixEvent, newThreadId: string): MatrixEvent {