hookshot/tests/utils/IntentMock.ts

37 lines
802 B
TypeScript
Raw Normal View History

2021-12-18 16:58:23 +00:00
export class MatrixClientMock {
async setDisplayName() {
return;
}
}
2020-11-22 21:31:39 +00:00
export class IntentMock {
2021-12-18 16:58:23 +00:00
public readonly underlyingClient = new MatrixClientMock();
2020-11-22 21:31:39 +00:00
public sentEvents: {roomId: string, content: any}[] = [];
static create(){
2020-11-22 21:31:39 +00:00
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return new this() as any;
}
sendText(roomId: string, noticeText: string, msgtype: string) {
this.sentEvents.push({
roomId,
content: {
msgtype,
body: noticeText,
}
});
}
sendEvent(roomId: string, content: any) {
this.sentEvents.push({
roomId,
content,
});
}
2021-12-18 16:58:23 +00:00
async ensureRegistered() {
return true;
}
}