@@ -216,7 +216,7 @@ await test('context-edit media reply when not a callback query', async t => {
216
216
strictEqual ( replyWithPhoto . mock . callCount ( ) , 1 ) ;
217
217
} ) ;
218
218
219
- await test ( 'context-edit media reply when text message' , async t => {
219
+ await test ( 'context-edit media reply when location message' , async t => {
220
220
const menu = new MenuTemplate < BaseContext > ( {
221
221
media : 'whatever' ,
222
222
type : 'photo' ,
@@ -252,7 +252,10 @@ await test('context-edit media reply when text message', async t => {
252
252
message_id : 666 ,
253
253
date : 666 ,
254
254
chat : undefined as any ,
255
- text : 'whatever' ,
255
+ location : {
256
+ latitude : 13 ,
257
+ longitude : 37 ,
258
+ } ,
256
259
} ,
257
260
} ,
258
261
deleteMessage,
@@ -306,6 +309,48 @@ await test('context-edit media edit when media message', async t => {
306
309
strictEqual ( editMessageMedia . mock . callCount ( ) , 1 ) ;
307
310
} ) ;
308
311
312
+ await test ( 'context-edit media edit when text message' , async t => {
313
+ const menu = new MenuTemplate < BaseContext > ( {
314
+ media : 'whatever' ,
315
+ type : 'photo' ,
316
+ } ) ;
317
+
318
+ const editMessageMedia = t . mock . fn < BaseContext [ 'editMessageMedia' ] > (
319
+ async ( media , other ) => {
320
+ deepStrictEqual ( media , {
321
+ media : 'whatever' ,
322
+ type : 'photo' ,
323
+ caption : undefined ,
324
+ parse_mode : undefined ,
325
+ } ) ;
326
+ deepStrictEqual ( other , {
327
+ reply_markup : {
328
+ inline_keyboard : [ ] ,
329
+ } ,
330
+ } ) ;
331
+ return undefined as any ;
332
+ } ,
333
+ ) ;
334
+ const fakeContext : Partial < BaseContext > = {
335
+ callbackQuery : {
336
+ id : '666' ,
337
+ from : undefined as any ,
338
+ chat_instance : '666' ,
339
+ data : '666' ,
340
+ message : {
341
+ message_id : 666 ,
342
+ date : 666 ,
343
+ chat : undefined as any ,
344
+ text : 'whatever' ,
345
+ } ,
346
+ } ,
347
+ editMessageMedia,
348
+ } ;
349
+
350
+ await editMenuOnContext ( menu , fakeContext as any , '/' ) ;
351
+ strictEqual ( editMessageMedia . mock . callCount ( ) , 1 ) ;
352
+ } ) ;
353
+
309
354
await test ( 'context-edit does not throw message is not modified' , async t => {
310
355
const menu = new MenuTemplate < BaseContext > ( 'whatever' ) ;
311
356
0 commit comments