@@ -169,6 +169,35 @@ describe('Create double elimination stage', () => {
169169
170170 assert . strictEqual ( ( await storage . select ( 'match' , 15 ) ) . number , 2 ) ; // Consolation final is number 2 of its round (arbitrary).
171171 } ) ;
172+
173+ it ( 'should create a consolation final in the final group without grand final' , async ( ) => {
174+ await manager . create . stage ( {
175+ name : 'Example with consolation final' ,
176+ tournamentId : 0 ,
177+ type : 'double_elimination' ,
178+ seeding : [
179+ 'Team 1' , 'Team 2' ,
180+ 'Team 3' , 'Team 4' ,
181+ 'Team 5' , 'Team 6' ,
182+ 'Team 7' , 'Team 8' ,
183+ ] ,
184+ settings : {
185+ grandFinal : 'none' ,
186+ consolationFinal : true ,
187+ seedOrdering : [ 'natural' ] ,
188+ } ,
189+ } ) ;
190+
191+ assert . deepEqual ( await storage . select ( 'group' ) , [
192+ { id : 0 , stage_id : 0 , number : 1 } ,
193+ { id : 1 , stage_id : 0 , number : 2 } ,
194+ { id : 2 , stage_id : 0 , number : 3 } , // Final group.
195+ ] ) ;
196+
197+ assert . strictEqual ( ( await storage . select ( 'round' ) ) . length , 3 + 4 + 1 /* consolation final */ ) ;
198+ assert . strictEqual ( ( await storage . select ( 'match' ) ) . length , 14 ) ;
199+ assert . strictEqual ( ( await storage . select ( 'match' , 13 ) ) . number , 2 ) ; // Consolation final is number 2 of its round (arbitrary).
200+ } ) ;
172201} ) ;
173202
174203describe ( 'Previous and next match update in double elimination stage' , ( ) => {
0 commit comments