|
1 | 1 | import { EventEmitter } from 'eventemitter3'; |
2 | | -import { type Link } from '../src/api'; |
| 2 | +import { Revision } from '../src/entities'; |
3 | 3 |
|
4 | | -export class MockLinkModule implements Link { |
5 | | - private emitter: EventEmitter; |
| 4 | +export class MockLink { |
| 5 | + private statusListener: ((status: string)=>Promise<void>) | null; |
| 6 | + private messageListener: ((message: any)=>Promise<void>) | null; |
| 7 | + private status: string; |
6 | 8 |
|
7 | 9 | constructor() { |
8 | | - this.emitter = new EventEmitter(); |
| 10 | + this.statusListener = null; |
| 11 | + this.messageListener = null; |
| 12 | + this.status = 'idle'; |
9 | 13 | } |
10 | 14 |
|
11 | | - public setStatusListener(ev: (status: string) => Promise<void>): void { |
| 15 | + public getIce(): { urls: string; username: string; credential: string }[] { |
| 16 | + return []; |
12 | 17 | } |
13 | 18 |
|
14 | | - public clearStatusListener(): void { |
| 19 | + public async call(node: string, secure: boolean, token: string, cardId: string, contactNode: string, contactSecure: boolean, contactGuid: string, contactToken: string) { |
| 20 | + return; |
15 | 21 | } |
16 | 22 |
|
17 | | - public setMessageListener(ev: (message: any) => Promise<void>): void { |
| 23 | + public async join(server: string, secure: boolean, token: string, ice: { urls: string; username: string; credential: string }[], endCall: ()=>Promise<void>) { |
| 24 | + return; |
18 | 25 | } |
19 | 26 |
|
20 | | - public clearMessageListener(): void { |
| 27 | + public async close() { |
| 28 | + return; |
21 | 29 | } |
22 | 30 |
|
23 | | - public getIce(): { urls: string; username: string; credential: string }[] { |
24 | | - return []; |
| 31 | + public setStatusListener(listener: (status: string) => Promise<void>) { |
| 32 | + this.statusListener = listener; |
| 33 | + this.statusListener(this.status); |
25 | 34 | } |
26 | | - |
27 | | - public async sendMessage(message: any): Promise<void> { |
| 35 | + |
| 36 | + public clearStatusListener() { |
| 37 | + this.statusListener = null; |
28 | 38 | } |
29 | 39 |
|
30 | | - public async close(): Promise<void> { |
| 40 | + public setMessageListener(listener: (message: any) => Promise<void>) { |
| 41 | + this.messageListener = listener; |
| 42 | + } |
| 43 | + |
| 44 | + public clearMessageListener() { |
| 45 | + this.messageListener = null; |
31 | 46 | } |
32 | 47 |
|
| 48 | + public async sendMessage(message: any) { |
| 49 | + } |
33 | 50 | } |
34 | 51 |
|
0 commit comments