Skip to content

Commit b5afd0c

Browse files
committed
Add test when there is at least more than 1 reminder in the queue
1 parent d9e7582 commit b5afd0c

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,3 @@ $ npm test
2828
## spec/convo/give_me_a_picture.convo.txt
2929

3030
This file is installed by one of botium packages. I couldn't figure out how to avoid it.
31-
32-
# TODOs
33-
34-
1. Test when there are at least 2 reminders in the queue

handle-response-reminders.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@ module.exports = ({ botMsg }) => {
1616

1717
// return "id: <id>, text: <text of action>" when handling list of reminders in the queue
1818
// what is returned is what we match with in the convo text (botiumscript) file
19-
let actual
19+
let actual = ''
2020
const regex = RegExp('<td>(.*?)</td>', 'gi')
2121

2222
let arr
23-
let i = 0
23+
let i = 0, j = 0
2424
while ((arr = regex.exec(botMsg.sourceData)) !== null) {
2525
arr[0] = arr[0].replace('<td>', '').replace('</td>', '')
26-
if (i === 0) {
27-
actual = `id: ${arr[0]}, text: `
28-
} else if (i === 2) {
26+
if (i != 0 && i % 3 === 0) {
27+
actual += '; '
28+
}
29+
if (i === 0+j) {
30+
actual += `id: ${arr[0]}, text: `
31+
} else if (i === 2+j) {
2932
actual += arr[0]
33+
j = 3
3034
}
3135
i++
3236
}

spec/convo/add-reminders.convo.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ show all reminders
2121
#bot
2222
id: 1, text: make dinner
2323

24-
#me
25-
clear all reminders
26-
27-
#bot
28-
Ok, I have cleared all of your reminders.
29-
3024
#me
3125
remind me to play ball in 10 minutes
3226

@@ -37,7 +31,7 @@ Ok, I will remind you to play ball in 600 seconds.
3731
show all reminders
3832

3933
#bot
40-
id: 2, text: play ball
34+
id: 1, text: make dinner; id: 2, text: play ball
4135

4236
#me
4337
clear all reminders

0 commit comments

Comments
 (0)