@@ -25,7 +25,7 @@ export async function createFakeMatch(
25
25
module : TestingModule ,
26
26
winner : DotaTeam = DotaTeam . RADIANT ,
27
27
mode : MatchmakingMode = MatchmakingMode . UNRANKED ,
28
- duration : number = 100
28
+ duration : number = 100 ,
29
29
) : Promise < FinishedMatchEntity > {
30
30
const matchRep = module . get < Repository < FinishedMatchEntity > > (
31
31
getRepositoryToken ( FinishedMatchEntity ) ,
@@ -59,38 +59,41 @@ export async function createFakeMatch(
59
59
return match ;
60
60
}
61
61
62
-
63
- export async function fillMatch ( module : TestingModule , fm : FinishedMatchEntity , count : number = 10 ) {
62
+ export async function fillMatch (
63
+ module : TestingModule ,
64
+ fm : FinishedMatchEntity ,
65
+ count : number = 10 ,
66
+ ) {
64
67
const pRep = module . get < Repository < PlayerInMatchEntity > > (
65
68
getRepositoryToken ( PlayerInMatchEntity ) ,
66
69
) ;
67
70
68
- const randInt = ( r : number ) => Math . round ( Math . random ( ) * r )
71
+ const randInt = ( r : number ) => Math . round ( Math . random ( ) * r ) ;
69
72
70
73
const pims : PlayerInMatchEntity [ ] = [ ] ;
71
74
for ( let i = 0 ; i < count ; i ++ ) {
72
75
const pim = new PlayerInMatchEntity ( ) ;
73
76
pim . match = fm ;
74
- pim . playerId = Math . round ( ( Math . random ( ) * 10000 + 1000000 ) ) . toString ( ) ;
77
+ pim . playerId = ` ${ fm . id } ${ randInt ( 1000000 ) } ${ i } ` ;
75
78
pim . abandoned = false ;
76
- pim . denies = randInt ( 50 )
77
- pim . last_hits = randInt ( 250 )
79
+ pim . denies = randInt ( 50 ) ;
80
+ pim . last_hits = randInt ( 250 ) ;
78
81
pim . kills = randInt ( 20 ) ;
79
82
pim . deaths = randInt ( 10 ) ;
80
83
pim . assists = randInt ( 20 ) ;
81
84
pim . team = i < count / 2 ? DotaTeam . RADIANT : DotaTeam . DIRE ;
82
85
pim . level = randInt ( 25 ) ;
83
86
pim . gpm = randInt ( 800 ) ;
84
87
pim . xpm = randInt ( 700 ) ;
85
- pim . hero = ' npc_dota_hero_riki' ;
86
- pim . item0 = randInt ( 100 )
87
- pim . item1 = randInt ( 100 )
88
- pim . item2 = randInt ( 100 )
89
- pim . item3 = randInt ( 100 )
90
- pim . item4 = randInt ( 100 )
91
- pim . item5 = randInt ( 100 )
88
+ pim . hero = " npc_dota_hero_riki" ;
89
+ pim . item0 = randInt ( 100 ) ;
90
+ pim . item1 = randInt ( 100 ) ;
91
+ pim . item2 = randInt ( 100 ) ;
92
+ pim . item3 = randInt ( 100 ) ;
93
+ pim . item4 = randInt ( 100 ) ;
94
+ pim . item5 = randInt ( 100 ) ;
92
95
await pRep . save ( pim ) ;
93
- pims . push ( pim )
96
+ pims . push ( pim ) ;
94
97
}
95
98
96
99
return pims ;
0 commit comments