File tree Expand file tree Collapse file tree
functions/src/api/routes/whatsapp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,4 +97,14 @@ describe('sendGoMessage', () => {
9797 expect ( sendMessage ) . toHaveBeenCalledWith ( 'c@c.us' , expect . stringContaining ( 'GO' ) )
9898 expect ( updated . goSent ) . toBe ( true )
9999 } )
100+
101+ test ( 'sends a funny GO message when nobody is ready' , async ( ) => {
102+ const { senders, sendMessage } = makeSenders ( )
103+ const session = await startTrackSession ( tracks ( 3 ) , 'c@c.us' , senders )
104+
105+ await sendGoMessage ( session , senders )
106+
107+ expect ( sendMessage ) . toHaveBeenCalledWith ( 'c@c.us' , expect . stringContaining ( '0/3' ) )
108+ expect ( sendMessage ) . toHaveBeenCalledWith ( 'c@c.us' , expect . stringContaining ( 'magie du live' ) )
109+ } )
100110} )
Original file line number Diff line number Diff line change @@ -32,10 +32,15 @@ export const allReady = (tracks: TrackState[]): boolean => tracks.length > 0 &&
3232export const goMessage = ( tracks : TrackState [ ] ) : string => {
3333 const notReady = tracks . filter ( ( t ) => ! t . ready )
3434 if ( notReady . length === 0 ) {
35- return `🟢 GO — all ${ tracks . length } tracks are ready. You can start.`
36- }
37- // Forced GO: some tracks never confirmed ready. Be explicit about which ones.
35+ return `🟢 GO — all ${ tracks . length } tracks are ready. You can start.`
36+ }
37+
3838 const readyCount = tracks . length - notReady . length
39+ if ( readyCount === 0 ) {
40+ return `🟢 GO — 0/${ tracks . length } tracks prêts. Le sondage ? Personne ne l'a vu. On y va quand même, c'est la magie du live 🦩`
41+ }
42+
43+ // Forced GO: some tracks never confirmed ready. Be explicit about which ones.
3944 const names = notReady . map ( ( t ) => t . name ) . join ( ', ' )
4045 return `🟢 GO — ${ readyCount } /${ tracks . length } tracks ready, starting anyway. Not ready: ${ names } .`
4146}
You can’t perform that action at this time.
0 commit comments