-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add delay registration to default scope handler #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple and clean. LGTM
const defaultHandler = spy(() => {});
const specificHandler = spy(() => {});
const commandGroup = new CommandGroup();
commandGroup.command("command", "_", defaultHandler, { prefix: "!" })
.addToScope({ type: "all_group_chats" }, specificHandler);
const bot = getBot();
bot.use(commands());
bot.use(commandGroup);
await bot.handleUpdate(
getDummyUpdate({
chatType: "group",
userInput: "!command",
}),
);
assertSpyCalls(defaultHandler, 0); // called once
assertSpyCalls(specificHandler, 1); // no call Set up this little integration test and it's failing. Also tried in a real bot, and the default handler it's still taking prevalence. Should I commit the test (+ the change to I'll take a look now on why is it not properly fixing the issue |
#50 (comment) needs to be fixed before tests are useful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The man as spoken
* fix: register default scope handler last * feat: add integration test for ensuring default handler is register last * fix: return main composer instead of the nested one * fix: return a completely new composer --------- Co-authored-by: Hero Protagonist <[email protected]>
Fixes #49