mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 20:14:02 +00:00
fix(bot): improve utilities reminder template flow
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user