Skip to content

Commit c74fd89

Browse files
committed
Add test
1 parent 5f57a81 commit c74fd89

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

spec/line/bot/client_parse_spec.rb

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,39 @@
237237
"timestamp": 12345678901234,
238238
"things": {
239239
"deviceId": "deviceid3",
240+
"type": "scenarioResult",
241+
"result": {
242+
"scenarioId": "DUMMY_SCENARIO_ID",
243+
"revision": 0,
244+
"resultCode": "success",
245+
"startTime": 1552375571097,
246+
"endTime": 1552375571098,
247+
"bleNotificationPayload": "AAAAAA==",
248+
"actionResults": [
249+
{
250+
"data": "mIcIAA==",
251+
"type": "binary"
252+
},
253+
{
254+
"type": "void"
255+
},
256+
{
257+
"type": "void"
258+
}
259+
]
260+
}
261+
}
262+
},
263+
{
264+
"type": "things",
265+
"replyToken": "nHuyWi...",
266+
"source": {
267+
"type": "user",
268+
"groupId": "U991eeaf62d..."
269+
},
270+
"timestamp": 12345678901234,
271+
"things": {
272+
"deviceId": "deviceid4",
240273
"type": "unsupport"
241274
}
242275
}
@@ -362,8 +395,13 @@ def generate_client
362395
expect(events[16].device_id).to eq('deviceid2')
363396

364397
expect(events[17]).to be_a(Line::Bot::Event::Things)
365-
expect(events[17].type).to eq(Line::Bot::Event::ThingsType::Unsupport)
398+
expect(events[17].type).to eq(Line::Bot::Event::ThingsType::ScenarioResult)
366399
expect(events[17].device_id).to eq('deviceid3')
400+
expect(events[17]["things"]["result"]["resultCode"]).to eq('success')
401+
402+
expect(events[18]).to be_a(Line::Bot::Event::Things)
403+
expect(events[18].type).to eq(Line::Bot::Event::ThingsType::Unsupport)
404+
expect(events[18].device_id).to eq('deviceid4')
367405
end
368406

369407
it 'parses unknown event' do

0 commit comments

Comments
 (0)