@ -100,7 +100,7 @@ final class ServerDataTests: XCTestCase {
return
}
let tournament = Tournament ( event : eventId , name : " RG Homme " , startDate : Date ( ) , endDate : nil , creationDate : Date ( ) , isPrivate : false , groupStageFormat : MatchFormat . megaTie , roundFormat : MatchFormat . nineGames , loserRoundFormat : MatchFormat . nineGamesDecisivePoint , groupStageSortMode : GroupStageOrderingMode . snake , groupStageCount : 2 , rankSourceDate : Date ( ) , dayDuration : 5 , teamCount : 3 , teamSorting : TeamSortingType . rank , federalCategory : TournamentCategory . mix , federalLevelCategory : TournamentLevel . p1000 , federalAgeCategory : FederalTournamentAge . a45 , closedRegistrationDate : Date ( ) , groupStageAdditionalQualified : 4 , courtCount : 9 , prioritizeClubMembers : true , qualifiedPerGroupStage : 1 , teamsPerGroupStage : 2 , entryFee : 30.0 , additionalEstimationDuration : 5 , isDeleted : true , publishTeams : true , publishSummons : true , publishGroupStages : true , publishBrackets : true , shouldVerifyBracket : true , shouldVerifyGroupStage : true , hideTeamsWeight : true , publishTournament : true , hidePointsEarned : true , publishRankings : true , loserBracketMode : . manual , initialSeedRound : 8 , initialSeedCount : 4 )
let tournament = Tournament ( event : eventId , name : " RG Homme " , startDate : Date ( ) , endDate : nil , creationDate : Date ( ) , isPrivate : false , groupStageFormat : MatchFormat . megaTie , roundFormat : MatchFormat . nineGames , loserRoundFormat : MatchFormat . nineGamesDecisivePoint , groupStageSortMode : GroupStageOrderingMode . snake , groupStageCount : 2 , rankSourceDate : Date ( ) , dayDuration : 5 , teamCount : 3 , teamSorting : TeamSortingType . rank , federalCategory : TournamentCategory . mix , federalLevelCategory : TournamentLevel . p1000 , federalAgeCategory : FederalTournamentAge . a45 , closedRegistrationDate : Date ( ) , groupStageAdditionalQualified : 4 , courtCount : 9 , prioritizeClubMembers : true , qualifiedPerGroupStage : 1 , teamsPerGroupStage : 2 , entryFee : 30.0 , additionalEstimationDuration : 5 , isDeleted : true , publishTeams : true , publishSummons : true , publishGroupStages : true , publishBrackets : true , shouldVerifyBracket : true , shouldVerifyGroupStage : true , hideTeamsWeight : true , publishTournament : true , hidePointsEarned : true , publishRankings : true , loserBracketMode : . manual , initialSeedRound : 8 , initialSeedCount : 4 , accountIsRequired : false , licenseIsRequired : false , minimumPlayerPerTeam : 3 , maximumPlayerPerTeam : 5 , information : " Super " , displayEntryFeeInformation : true )
let t = try await StoreCenter . main . service ( ) . post ( tournament )
assert ( t . event = = tournament . event )
@ -143,6 +143,12 @@ final class ServerDataTests: XCTestCase {
assert ( t . loserBracketMode = = tournament . loserBracketMode )
assert ( t . initialSeedCount = = tournament . initialSeedCount )
assert ( t . initialSeedRound = = tournament . initialSeedRound )
assert ( t . accountIsRequired = = tournament . accountIsRequired )
assert ( t . licenseIsRequired = = tournament . licenseIsRequired )
assert ( t . minimumPlayerPerTeam = = tournament . minimumPlayerPerTeam )
assert ( t . maximumPlayerPerTeam = = tournament . maximumPlayerPerTeam )
assert ( t . information = = tournament . information )
assert ( t . displayEntryFeeInformation = = tournament . displayEntryFeeInformation )
}
func testGroupStage ( ) async throws {
@ -203,7 +209,7 @@ final class ServerDataTests: XCTestCase {
return
}
let teamRegistration = TeamRegistration ( tournament : tournamentId , groupStage : groupStageId , registrationDate : Date ( ) , callDate : Date ( ) , bracketPosition : 1 , groupStagePosition : 2 , comment : " comment " , source : " source " , sourceValue : " source V " , logo : " logo " , name : " Stax " , walkOut : true , wildCardBracket : true , wildCardGroupStage : true , weight : 1 , lockedWeight : 11 , confirmationDate : Date ( ) , qualified : true )
let teamRegistration = TeamRegistration ( tournament : tournamentId , groupStage : groupStageId , registrationDate : Date ( ) , callDate : Date ( ) , bracketPosition : 1 , groupStagePosition : 2 , comment : " comment " , source : " source " , sourceValue : " source V " , logo : " logo " , name : " Stax " , walkOut : true , wildCardBracket : true , wildCardGroupStage : true , weight : 1 , lockedWeight : 11 , confirmationDate : Date ( ) , qualified : true , finalRanking : 4 , pointsEarned : 200 , unregistered : true , unregistrationDate : Date ( ) )
let tr : TeamRegistration = try await StoreCenter . main . service ( ) . post ( teamRegistration )
@ -225,7 +231,10 @@ final class ServerDataTests: XCTestCase {
assert ( tr . lockedWeight = = teamRegistration . lockedWeight )
assert ( tr . confirmationDate ? . formatted ( ) = = teamRegistration . confirmationDate ? . formatted ( ) )
assert ( tr . qualified = = teamRegistration . qualified )
assert ( tr . finalRanking = = teamRegistration . finalRanking )
assert ( tr . pointsEarned = = teamRegistration . pointsEarned )
assert ( tr . unregistered = = teamRegistration . unregistered )
assert ( tr . unregistrationDate ? . formatted ( ) = = teamRegistration . unregistrationDate ? . formatted ( ) )
}
func testPlayerRegistration ( ) async throws {
@ -236,7 +245,7 @@ final class ServerDataTests: XCTestCase {
return
}
let playerRegistration = PlayerRegistration ( teamRegistration : teamRegistrationId , firstName : " juan " , lastName : " lebron " , licenceId : " 123 " , rank : 11 , paymentType : PlayerRegistration . PlayerPaymentType . cash , sex : PlayerRegistration . PlayerSexType . male , tournamentPlayed : 2 , points : 33 , clubName : " le club " , ligueName : " la league " , assimilation : " ass " , phoneNumber : " 123123 " , email : " email@email.com " , birthdate : nil , computedRank : 222 , source : PlayerRegistration . PlayerDataSource . frenchFederation , hasArrived : true )
let playerRegistration = PlayerRegistration ( teamRegistration : teamRegistrationId , firstName : " juan " , lastName : " lebron " , licenceId : " 123 " , rank : 11 , paymentType : PlayerRegistration . PlayerPaymentType . cash , sex : PlayerRegistration . PlayerSexType . male , tournamentPlayed : 2 , points : 33 , clubName : " le club " , ligueName : " la league " , assimilation : " ass " , phoneNumber : " 123123 " , email : " email@email.com " , birthdate : nil , computedRank : 222 , source : PlayerRegistration . PlayerDataSource . frenchFederation , hasArrived : true , coach : true , captain : true )
let pr : PlayerRegistration = try await StoreCenter . main . service ( ) . post ( playerRegistration )
assert ( pr . teamRegistration = = playerRegistration . teamRegistration )
@ -256,7 +265,9 @@ final class ServerDataTests: XCTestCase {
assert ( pr . computedRank = = playerRegistration . computedRank )
assert ( pr . source = = playerRegistration . source )
assert ( pr . hasArrived = = playerRegistration . hasArrived )
assert ( pr . captain = = playerRegistration . captain )
assert ( pr . coach = = playerRegistration . coach )
}
func testMatch ( ) async throws {