fix(bot): improve utilities reminder template flow

This commit is contained in:
2026-03-12 02:54:42 +04:00
parent ce8f0b5b93
commit e56f1194e9
4 changed files with 69 additions and 19 deletions

View File

@@ -375,7 +375,8 @@ describe('registerReminderTopicUtilities', () => {
expect(calls[1]).toMatchObject({
method: 'sendMessage',
payload: {
text: expect.stringContaining('Electricity:'),
text: expect.stringContaining('<pre>Electricity: \nWater: </pre>'),
parse_mode: 'HTML',
message_thread_id: 555
}
})
@@ -391,6 +392,34 @@ describe('registerReminderTopicUtilities', () => {
})
})
test('treats blank or removed template lines as skipped categories', async () => {
const { bot, calls } = setupBot()
await bot.handleUpdate(reminderCallbackUpdate(REMINDER_UTILITY_TEMPLATE_CALLBACK) as never)
calls.length = 0
await bot.handleUpdate(reminderMessageUpdate('Electricity: 22\nWater: ') as never)
expect(calls[0]).toMatchObject({
method: 'sendMessage',
payload: {
text: expect.stringContaining('- Electricity: 22.00 GEL')
}
})
calls.length = 0
await bot.handleUpdate(reminderCallbackUpdate(REMINDER_UTILITY_TEMPLATE_CALLBACK) as never)
calls.length = 0
await bot.handleUpdate(reminderMessageUpdate('Electricity: 22') as never)
expect(calls[0]).toMatchObject({
method: 'sendMessage',
payload: {
text: expect.stringContaining('- Electricity: 22.00 GEL')
}
})
})
test('treats expired pending reminder submissions as unavailable', async () => {
const { bot, calls, promptRepository } = setupBot()