Use doMaybeLocalRoomAction (#9038)
* Use doMaybeLocalRoomAction * Revert unnecessary changes
This commit is contained in:
parent
9b8b8763f7
commit
3be20cf434
12 changed files with 333 additions and 22 deletions
|
@ -71,20 +71,23 @@ export function stubClient() {
|
|||
*/
|
||||
export function createTestClient(): MatrixClient {
|
||||
const eventEmitter = new EventEmitter();
|
||||
let txnId = 1;
|
||||
|
||||
return {
|
||||
getHomeserverUrl: jest.fn(),
|
||||
getIdentityServerUrl: jest.fn(),
|
||||
getDomain: jest.fn().mockReturnValue("matrix.rog"),
|
||||
getUserId: jest.fn().mockReturnValue("@userId:matrix.rog"),
|
||||
getDomain: jest.fn().mockReturnValue("matrix.org"),
|
||||
getUserId: jest.fn().mockReturnValue("@userId:matrix.org"),
|
||||
getUser: jest.fn().mockReturnValue({ on: jest.fn() }),
|
||||
getDeviceId: jest.fn().mockReturnValue("ABCDEFGHI"),
|
||||
getDevices: jest.fn().mockResolvedValue({ devices: [{ device_id: "ABCDEFGHI" }] }),
|
||||
credentials: { userId: "@userId:matrix.rog" },
|
||||
credentials: { userId: "@userId:matrix.org" },
|
||||
|
||||
store: {
|
||||
getPendingEvents: jest.fn().mockResolvedValue([]),
|
||||
setPendingEvents: jest.fn().mockResolvedValue(undefined),
|
||||
storeRoom: jest.fn(),
|
||||
removeRoom: jest.fn(),
|
||||
},
|
||||
|
||||
getPushActionsForEvent: jest.fn(),
|
||||
|
@ -124,7 +127,7 @@ export function createTestClient(): MatrixClient {
|
|||
setRoomAccountData: jest.fn(),
|
||||
setRoomTopic: jest.fn(),
|
||||
sendTyping: jest.fn().mockResolvedValue({}),
|
||||
sendMessage: () => jest.fn().mockResolvedValue({}),
|
||||
sendMessage: jest.fn().mockResolvedValue({}),
|
||||
sendStateEvent: jest.fn().mockResolvedValue(undefined),
|
||||
getSyncState: () => "SYNCING",
|
||||
generateClientSecret: () => "t35tcl1Ent5ECr3T",
|
||||
|
@ -157,6 +160,7 @@ export function createTestClient(): MatrixClient {
|
|||
isInitialSyncComplete: jest.fn().mockReturnValue(true),
|
||||
downloadKeys: jest.fn(),
|
||||
fetchRoomEvent: jest.fn(),
|
||||
makeTxnId: jest.fn().mockImplementation(() => `t${txnId++}`),
|
||||
} as unknown as MatrixClient;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue