mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-31 06:16:07 +00:00
src/telegram: reset state of global regexp (#326)
References: * BR: https://github.com/yagop/node-telegram-bot-api/issues/325 * BR-by: @Sirius-A * PR: https://github.com/yagop/node-telegram-bot-api/pull/326 * PR-by: @Sirius-A
This commit is contained in:
@@ -975,6 +975,16 @@ describe('TelegramBot', function telegramSuite() {
|
||||
message: { text: '/onText ECHO ALOHA' },
|
||||
});
|
||||
});
|
||||
it('should reset the global regex state with each message', function test(done) {
|
||||
const regexp = /\/onText (.+)/g;
|
||||
botWebHook.onText(regexp, () => {
|
||||
assert.equal(regexp.lastIndex, 0);
|
||||
return done();
|
||||
});
|
||||
utils.sendWebHookMessage(webHookPort2, TOKEN, {
|
||||
message: { text: '/onText ECHO ALOHA' },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('#onReplyToMessage', function onReplyToMessageSuite() {});
|
||||
|
Reference in New Issue
Block a user