@@ -29,6 +29,7 @@ import * as SlashCommands from "../../../../../../src/SlashCommands";
2929import * as Commands from "../../../../../../src/editor/commands" ;
3030import * as Reply from "../../../../../../src/utils/Reply" ;
3131import { MatrixClientPeg } from "../../../../../../src/MatrixClientPeg" ;
32+ import { Action } from "../../../../../../src/dispatcher/actions" ;
3233
3334describe ( "message" , ( ) => {
3435 const permalinkCreator = {
@@ -355,7 +356,7 @@ describe("message", () => {
355356 } ,
356357 ) ;
357358
358- it ( "if user enters invalid command and then sends it anyway, message is sent " , async ( ) => {
359+ it ( "if user enters invalid command and then sends it anyway" , async ( ) => {
359360 // mock out returning a true value for `shouldSendAnyway` to avoid rendering the modal
360361 jest . spyOn ( Commands , "shouldSendAnyway" ) . mockResolvedValue ( true ) ;
361362 const invalidCommandInput = "/badCommand" ;
@@ -366,11 +367,14 @@ describe("message", () => {
366367 permalinkCreator,
367368 } ) ;
368369
370+ // we expect the message to have been sent
371+ // and a composer focus action to have been dispatched
369372 expect ( mockClient . sendMessage ) . toHaveBeenCalledWith (
370373 "myfakeroom" ,
371374 null ,
372375 expect . objectContaining ( { body : invalidCommandInput } ) ,
373376 ) ;
377+ expect ( spyDispatcher ) . toHaveBeenCalledWith ( expect . objectContaining ( { action : Action . FocusAComposer } ) ) ;
374378 } ) ;
375379
376380 it ( "if user enters invalid command and then does not send, return undefined" , async ( ) => {
0 commit comments