Open dcsan opened 1 year ago
since its hard to send messages via ATproto and to test the bot I made a little MockBot that allows me to at least write simple tests for bots.
this isn't really part of the bot sdk. but maybe the MockBot could be? I also didn't stub out a lot of the methods.
LMK if you have any better ideas how to do this! or more portable.
i'll wrap it up in a proper testrunner at some point too.
export class MockBot { lastReply: string = '' reply(text: string, post: any) { // ignore post for now this.lastReply = text; console.log(`mockBot.reply: ${text}`); } } export class MockEvent { post: any; constructor(post: any) { this.post = post; } }
https://github.com/dcsan/bsky-faq-bot/blob/main/src/test/dispatcher.test.ts
since its hard to send messages via ATproto and to test the bot I made a little MockBot that allows me to at least write simple tests for bots.
this isn't really part of the bot sdk. but maybe the MockBot could be? I also didn't stub out a lot of the methods.
LMK if you have any better ideas how to do this! or more portable.
i'll wrap it up in a proper testrunner at some point too.
https://github.com/dcsan/bsky-faq-bot/blob/main/src/test/dispatcher.test.ts