@@ -22,11 +22,11 @@ describe('ActivityHandler', function() {
22
22
await bot . run ( context ) . catch ( error => done ( error ) ) ;
23
23
}
24
24
25
- it ( `should fire onTurn for any inbound activity` , async function ( done ) {
25
+ it ( `should fire onTurn for any inbound activity` , async function ( done ) {
26
26
27
27
const bot = new ActivityHandler ( ) ;
28
28
29
- bot . onTurn ( async ( context , next ) => {
29
+ bot . onTurn ( async ( context , next ) => {
30
30
assert ( true , 'onTurn not called' ) ;
31
31
done ( ) ;
32
32
await next ( ) ;
@@ -35,66 +35,66 @@ describe('ActivityHandler', function() {
35
35
processActivity ( { type : 'any' } , bot , done ) ;
36
36
} ) ;
37
37
38
- it ( `should fire onMessage for any message activities` , async function ( done ) {
38
+ it ( `should fire onMessage for any message activities` , async function ( done ) {
39
39
40
40
const bot = new ActivityHandler ( ) ;
41
41
42
- bot . onMessage ( async ( context , next ) => {
42
+ bot . onMessage ( async ( context , next ) => {
43
43
assert ( true , 'onMessage not called' ) ;
44
44
done ( ) ;
45
45
await next ( ) ;
46
46
} ) ;
47
47
48
- processActivity ( { type : 'message' } , bot , done ) ;
48
+ processActivity ( { type : ActivityTypes . Message } , bot , done ) ;
49
49
} ) ;
50
50
51
- it ( `calling next allows following events to firing` , async function ( done ) {
51
+ it ( `calling next allows following events to firing` , async function ( done ) {
52
52
53
53
const bot = new ActivityHandler ( ) ;
54
54
55
- bot . onTurn ( async ( context , next ) => {
55
+ bot . onTurn ( async ( context , next ) => {
56
56
assert ( true , 'onTurn not called' ) ;
57
57
await next ( ) ;
58
58
} ) ;
59
59
60
- bot . onMessage ( async ( context , next ) => {
60
+ bot . onMessage ( async ( context , next ) => {
61
61
assert ( true , 'onMessage not called' ) ;
62
62
done ( ) ;
63
63
await next ( ) ;
64
64
} ) ;
65
65
66
- processActivity ( { type : 'message' } , bot , done ) ;
66
+ processActivity ( { type : ActivityTypes . Message } , bot , done ) ;
67
67
} ) ;
68
68
69
- it ( `omitting call to next prevents following events from firing` , async function ( done ) {
69
+ it ( `omitting call to next prevents following events from firing` , async function ( done ) {
70
70
71
71
const bot = new ActivityHandler ( ) ;
72
72
73
- bot . onTurn ( async ( context , next ) => {
73
+ bot . onTurn ( async ( context , next ) => {
74
74
assert ( true , 'onTurn not called' ) ;
75
75
done ( ) ;
76
76
} ) ;
77
77
78
- bot . onMessage ( async ( context , next ) => {
78
+ bot . onMessage ( async ( context , next ) => {
79
79
assert ( false , 'onMessage called improperly!' ) ;
80
80
await next ( ) ;
81
81
} ) ;
82
82
83
- processActivity ( { type : 'message' } , bot , done ) ;
83
+ processActivity ( { type : ActivityTypes . Message } , bot , done ) ;
84
84
} ) ;
85
85
86
- it ( `binding 2 methods to the same event both fire` , async function ( done ) {
86
+ it ( `binding 2 methods to the same event both fire` , async function ( done ) {
87
87
88
88
const bot = new ActivityHandler ( ) ;
89
89
let count = 0 ;
90
90
91
- bot . onMessage ( async ( context , next ) => {
91
+ bot . onMessage ( async ( context , next ) => {
92
92
assert ( true , 'event 1 did not fire' ) ;
93
93
count ++ ;
94
94
await next ( ) ;
95
95
} ) ;
96
96
97
- bot . onMessage ( async ( context , next ) => {
97
+ bot . onMessage ( async ( context , next ) => {
98
98
assert ( true , 'event 2 did not fire' ) ;
99
99
count ++ ;
100
100
@@ -103,14 +103,14 @@ describe('ActivityHandler', function() {
103
103
await next ( ) ;
104
104
} ) ;
105
105
106
- processActivity ( { type : 'message' } , bot , done ) ;
106
+ processActivity ( { type : ActivityTypes . Message } , bot , done ) ;
107
107
} ) ;
108
108
109
- it ( `should fire onConversationUpdate` , async function ( done ) {
109
+ it ( `should fire onConversationUpdate` , async function ( done ) {
110
110
111
111
const bot = new ActivityHandler ( ) ;
112
112
113
- bot . onConversationUpdate ( async ( context , next ) => {
113
+ bot . onConversationUpdate ( async ( context , next ) => {
114
114
assert ( true , 'onConversationUpdate not called' ) ;
115
115
done ( ) ;
116
116
await next ( ) ;
@@ -119,11 +119,11 @@ describe('ActivityHandler', function() {
119
119
processActivity ( { type : ActivityTypes . ConversationUpdate } , bot , done ) ;
120
120
} ) ;
121
121
122
- it ( `should fire onMembersAdded` , async function ( done ) {
122
+ it ( `should fire onMembersAdded` , async function ( done ) {
123
123
124
124
const bot = new ActivityHandler ( ) ;
125
125
126
- bot . onMembersAdded ( async ( context , next ) => {
126
+ bot . onMembersAdded ( async ( context , next ) => {
127
127
assert ( true , 'onConversationUpdate not called' ) ;
128
128
done ( ) ;
129
129
await next ( ) ;
@@ -132,11 +132,11 @@ describe('ActivityHandler', function() {
132
132
processActivity ( { type : ActivityTypes . ConversationUpdate , membersAdded : [ { id : 1 } ] } , bot , done ) ;
133
133
} ) ;
134
134
135
- it ( `should fire onMembersRemoved` , async function ( done ) {
135
+ it ( `should fire onMembersRemoved` , async function ( done ) {
136
136
137
137
const bot = new ActivityHandler ( ) ;
138
138
139
- bot . onMembersRemoved ( async ( context , next ) => {
139
+ bot . onMembersRemoved ( async ( context , next ) => {
140
140
assert ( true , 'onMembersRemoved not called' ) ;
141
141
done ( ) ;
142
142
await next ( ) ;
@@ -145,11 +145,11 @@ describe('ActivityHandler', function() {
145
145
processActivity ( { type : ActivityTypes . ConversationUpdate , membersRemoved : [ { id : 1 } ] } , bot , done ) ;
146
146
} ) ;
147
147
148
- it ( `should fire onMessageReaction` , async function ( done ) {
148
+ it ( `should fire onMessageReaction` , async function ( done ) {
149
149
150
150
const bot = new ActivityHandler ( ) ;
151
151
152
- bot . onMessageReaction ( async ( context , next ) => {
152
+ bot . onMessageReaction ( async ( context , next ) => {
153
153
assert ( true , 'onMessageReaction not called' ) ;
154
154
done ( ) ;
155
155
await next ( ) ;
@@ -158,11 +158,11 @@ describe('ActivityHandler', function() {
158
158
processActivity ( { type : ActivityTypes . MessageReaction } , bot , done ) ;
159
159
} ) ;
160
160
161
- it ( `should fire onReactionsAdded` , async function ( done ) {
161
+ it ( `should fire onReactionsAdded` , async function ( done ) {
162
162
163
163
const bot = new ActivityHandler ( ) ;
164
164
165
- bot . onReactionsAdded ( async ( context , next ) => {
165
+ bot . onReactionsAdded ( async ( context , next ) => {
166
166
assert ( true , 'onReactionsAdded not called' ) ;
167
167
done ( ) ;
168
168
await next ( ) ;
@@ -171,11 +171,11 @@ describe('ActivityHandler', function() {
171
171
processActivity ( { type : ActivityTypes . MessageReaction , reactionsAdded : [ { type : 'like' } ] } , bot , done ) ;
172
172
} ) ;
173
173
174
- it ( `should fire onReactionsRemoved` , async function ( done ) {
174
+ it ( `should fire onReactionsRemoved` , async function ( done ) {
175
175
176
176
const bot = new ActivityHandler ( ) ;
177
177
178
- bot . onReactionsRemoved ( async ( context , next ) => {
178
+ bot . onReactionsRemoved ( async ( context , next ) => {
179
179
assert ( true , 'onReactionsRemoved not called' ) ;
180
180
done ( ) ;
181
181
await next ( ) ;
@@ -184,11 +184,11 @@ describe('ActivityHandler', function() {
184
184
processActivity ( { type : ActivityTypes . MessageReaction , reactionsRemoved : [ { type : 'like' } ] } , bot , done ) ;
185
185
} ) ;
186
186
187
- it ( `should fire onEvent` , async function ( done ) {
187
+ it ( `should fire onEvent` , async function ( done ) {
188
188
189
189
const bot = new ActivityHandler ( ) ;
190
190
191
- bot . onEvent ( async ( context , next ) => {
191
+ bot . onEvent ( async ( context , next ) => {
192
192
assert ( true , 'onEvent not called' ) ;
193
193
done ( ) ;
194
194
await next ( ) ;
@@ -197,12 +197,37 @@ describe('ActivityHandler', function() {
197
197
processActivity ( { type : ActivityTypes . Event } , bot , done ) ;
198
198
} ) ;
199
199
200
+ it ( `should fire onEndOfConversation` , async function ( done ) {
200
201
201
- it ( `should fire onUnrecognizedActivityType` , async function ( done ) {
202
+ const bot = new ActivityHandler ( ) ;
203
+
204
+ bot . onEndOfConversation ( async ( context , next ) => {
205
+ assert ( true , 'onEndOfConversation not called' ) ;
206
+ done ( ) ;
207
+ await next ( ) ;
208
+ } ) ;
209
+
210
+ processActivity ( { type : ActivityTypes . EndOfConversation } , bot , done ) ;
211
+ } ) ;
212
+
213
+ it ( `should fire onTyping` , async function ( done ) {
214
+
215
+ const bot = new ActivityHandler ( ) ;
216
+
217
+ bot . onTyping ( async ( context , next ) => {
218
+ assert ( true , 'onTyping not called' ) ;
219
+ done ( ) ;
220
+ await next ( ) ;
221
+ } ) ;
222
+
223
+ processActivity ( { type : ActivityTypes . Typing } , bot , done ) ;
224
+ } ) ;
225
+
226
+ it ( `should fire onUnrecognizedActivityType` , async function ( done ) {
202
227
203
228
const bot = new ActivityHandler ( ) ;
204
229
205
- bot . onUnrecognizedActivityType ( async ( context , next ) => {
230
+ bot . onUnrecognizedActivityType ( async ( context , next ) => {
206
231
assert ( true , 'onUnrecognizedActivityType not called' ) ;
207
232
done ( ) ;
208
233
await next ( ) ;
@@ -211,11 +236,11 @@ describe('ActivityHandler', function() {
211
236
processActivity ( { type : 'foo' } , bot , done ) ;
212
237
} ) ;
213
238
214
- it ( `should fire onDialog` , async function ( done ) {
239
+ it ( `should fire onDialog` , async function ( done ) {
215
240
216
241
const bot = new ActivityHandler ( ) ;
217
242
218
- bot . onDialog ( async ( context , next ) => {
243
+ bot . onDialog ( async ( context , next ) => {
219
244
assert ( true , 'onDialog not called' ) ;
220
245
done ( ) ;
221
246
await next ( ) ;
0 commit comments