import { EventEmitter } from 'eventemitter3'; import type { Contact, Link } from '../src/api'; import { MockLinkModule } from './link'; import type { Card, Channel, Article, Topic, Asset, Tag, Profile, Participant} from '../src/types'; export class MockContactModule implements Contact { public revision: number; private emitter: EventEmitter; constructor() { this.revision = 0; this.emitter = new EventEmitter(); } public addCardListener(ev: (cards: Card[]) => void): void { this.emitter.on('card', ev); } public removeCardListener(ev: (cards: Card[]) => void): void { this.emitter.off('card', ev); } public addLoadedListener(ev: (loaded: boolean) => void): void { this.emitter.on('loaded', ev); } public removeLoadedListener(ev: (loaded: boolean) => void): void { this.emitter.off('loaded', ev); } public close(): void { } public async setRevision(rev: number): Promise { this.revision = rev; } public async addCard(server: string, guid: string): Promise { return ''; } public async addAndConnectCard(server: string, guid: string): Promise { } public async removeCard(cardId: string): Promise { } public async confirmCard(cardId: string): Promise { } public async connectCard(cardId: string): Promise { } public async disconnectCard(cardId: string): Promise { } public async rejectCard(cardId: string): Promise { } public async ignoreCard(cardId: string): Promise { } public async resyncCard(cardId: string): Promise { } public async flagCard(cardId: string): Promise { } public async flagArticle(cardId: string, articleId: string): Promise { } public async flagChannel(cardId: string, channelId: string): Promise { } public async flagTopic(cardId: string, channelId: string, topicId: string): Promise { } public async flagTag(cardId: string, channelId: string, topicId: string, tagId: string): Promise { } public async setBlockCard(cardId: string): Promise { } public async setBlockArticle(cardId: string, articleId: string): Promise { } public async setBlockChannel(cardId: string, channelId: string): Promise { } public async setBlockTopic(cardId: string, channelId: string, topicId: string): Promise { } public async setBlockTag(cardId: string, channelId: string, topicId: string, tagId: string): Promise { } public async clearBlockCard(cardId: string): Promise { } public async clearBlockArticle(cardId: string, articleId: string): Promise { } public async clearBlockChannel(cardId: string, channelId: string): Promise { } public async clearBlockTopic(cardId: string, channelId: string, topicId: string): Promise { } public async clearBlockTag(cardId: string, channelId: string, topicId: string, tagId: string): Promise { } public async getBlockedCards(): Promise { return []; } public async getBlockedChannels(): Promise { return []; } public async getBlockedTopics(): Promise { return []; } public async getBlockedTags(): Promise { return []; } public async getBlockedArticles(): Promise { return []; } public async enableChannelNotifications(cardId: string, channelId: string): Promise { } public async disableChannelNotifications(cardId: string, channelId: string): Promise { } public async removeArticle(cardId: string, articleId: string): Promise { } public async leaveChannel(cardId: string, channelId: string): Promise { } public async addTopic(cardId: string, channelId: string, type: string, message: string, assets: Asset[]): Promise { return ''; } public async removeTopic(cardId: string, channelId: string, topicId: string): Promise { } public async setTopicSubject(cardId: string, channelId: string, topicId: string, subject: string): Promise { } public async setTopicSort(cardId: string, channelId: string, topicId: string, sort: number): Promise { } public async addTag(cardId: string, channelId: string, topicId: string, type: string, value: string): Promise { return ''; } public async removeTag(cardId: string, channelId: string, topicId: string, tagId: string): Promise { } public async setTagSubject(cardId: string, channelId: string, topicId: string, tagId: string, subject: string): Promise { } public async setTagSort(cardId: string, channelId: string, topicId: string, tagId: string, sort: number): Promise { } public async getTopics(cardId: string, channelId: string): Promise { return []; } public async getMoreTopics(cardId: string, channelId: string): Promise { return []; } public async getTags(cardId: string, channelId: string, topicId: string): Promise { return []; } public async getMoreTags(cardId: string, channelId: string, topicId: string): Promise { return []; } public async setUnreadChannel(cardId: string, channelId: string): Promise { } public async clearUnreadChannel(cardId: string, channelId: string): Promise { } public async getRegistry(server: string): Promise { return []; } public getTopicAssetUrl(cardId: string, channelId: string, topicId: string, assetId: string): string { return ''; } public async addParticipantAccess(cardId: string, channelId: string, name: string): Promise { return { id: '', name: '', node: '', secure: false, token: '' }; } public async removeParticipantAccess(cardId: string, channelId: string, participantId: string): Promise { } public async denyCard(cardId: string): Promise { } public async setBlockedCard(cardId: string, blocked: boolean): Promise { } public async setBlockedArticle(cardId: string, articleId: string, blocked: boolean): Promise { } public async setBlockedChannel(cardId: string, channelId: string, blocked: boolean): Promise { } public async getChannelNotifications(cardId: string, channelId: string): Promise { return false; } public async setChannelNotifications(cardId: string, channelId: string, enabled: boolean): Promise { } public addChannelListener(ev: (arg: { cardId: string | null; channels: Channel[] }) => void): void { } public removeChannelListener(ev: (arg: { cardId: string | null; channels: Channel[] }) => void): void { } public async callCard(cardId: string): Promise { return new MockLinkModule(); } }