From 1143f5174476556c8174069e198814c8e69f2c34 Mon Sep 17 00:00:00 2001 From: Raz Date: Fri, 18 Apr 2025 19:06:50 +0200 Subject: [PATCH] add missing variables in xctests --- PadelClubTests/ServerDataTests.swift | 19 +++++++++++++++++-- PadelClubTests/UserDataTests.swift | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/PadelClubTests/ServerDataTests.swift b/PadelClubTests/ServerDataTests.swift index c0d7984..62c1628 100644 --- a/PadelClubTests/ServerDataTests.swift +++ b/PadelClubTests/ServerDataTests.swift @@ -113,7 +113,8 @@ 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, accountIsRequired: false, licenseIsRequired: false, minimumPlayerPerTeam: 3, maximumPlayerPerTeam: 5, information: "Super", umpireCustomMail: "razmig@padelclub.app", umpireCustomContact: "Raz", umpireCustomPhone: "+33681598193", hideUmpireMail: true, hideUmpirePhone: true, disableRankingFederalRuling: true, teamCountLimit: false) + 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, shouldVerifyGroupStage: true, shouldVerifyBracket: 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", umpireCustomMail: "razmig@padelclub.app", umpireCustomContact: "Raz", umpireCustomPhone: "+33681598193", hideUmpireMail: true, hideUmpirePhone: true, disableRankingFederalRuling: true, teamCountLimit: false, enableOnlinePayment: false, onlinePaymentIsMandatory: false, enableOnlinePaymentRefund: false, refundDateLimit: nil, stripeAccountId: nil, enableTimeToConfirm: false, isCorporateTournament: false, isTemplate: false + ) tournament.isCanceled = true tournament.payment = .subscriptionUnit @@ -176,6 +177,14 @@ final class ServerDataTests: XCTestCase { assert(t.hideUmpirePhone == tournament.hideUmpirePhone) assert(t.disableRankingFederalRuling == tournament.disableRankingFederalRuling) assert(t.teamCountLimit == tournament.teamCountLimit) + assert(t.enableOnlinePayment == tournament.enableOnlinePayment) + assert(t.onlinePaymentIsMandatory == tournament.onlinePaymentIsMandatory) + assert(t.enableOnlinePaymentRefund == tournament.enableOnlinePaymentRefund) + assert(t.refundDateLimit?.formatted() == tournament.refundDateLimit?.formatted()) + assert(t.stripeAccountId == tournament.stripeAccountId) + assert(t.enableTimeToConfirm == tournament.enableTimeToConfirm) + assert(t.isCorporateTournament == tournament.isCorporateTournament) + assert(t.isTemplate == tournament.isTemplate) } else { XCTFail("missing data") } @@ -289,7 +298,7 @@ final class ServerDataTests: XCTestCase { return } - let playerRegistration = PlayerRegistration(teamRegistration: teamRegistrationId, firstName: "juan", lastName: "lebron", licenceId: "123", rank: 11, paymentType: PlayerPaymentType.cash, sex: 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: PlayerPaymentType.cash, sex: 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: false, captain: false, registeredOnline: false, timeToConfirm: nil, registrationStatus: PlayerRegistration.RegistrationStatus.waiting, paymentId: nil) playerRegistration.storeId = "123" if let pr: PlayerRegistration = try await StoreCenter.main.service().post(playerRegistration) { @@ -316,6 +325,12 @@ final class ServerDataTests: XCTestCase { assert(pr.captain == playerRegistration.captain) assert(pr.coach == playerRegistration.coach) assert(pr.registeredOnline == playerRegistration.registeredOnline) + assert(pr.captain == playerRegistration.captain) + assert(pr.coach == playerRegistration.coach) + assert(pr.registeredOnline == playerRegistration.registeredOnline) + assert(pr.timeToConfirm == playerRegistration.timeToConfirm) + assert(pr.registrationStatus == playerRegistration.registrationStatus) + assert(pr.paymentId == playerRegistration.paymentId) } else { XCTFail("missing data") } diff --git a/PadelClubTests/UserDataTests.swift b/PadelClubTests/UserDataTests.swift index c5a9f63..e522370 100644 --- a/PadelClubTests/UserDataTests.swift +++ b/PadelClubTests/UserDataTests.swift @@ -64,6 +64,15 @@ final class UserDataTests: XCTestCase { user.groupStageMatchFormatPreference = MatchFormat.twoSets user.loserBracketMatchFormatPreference = MatchFormat.twoSetsOfFourGames user.loserBracketMode = .manual + user.disableRankingFederalRuling = false + user.deviceId = "device123" + user.agents = ["agent1", "agent2"] + user.userRole = 2 + user.registrationPaymentMode = .disabled + user.umpireCustomMail = "umpire@example.com" + user.umpireCustomContact = "John Umpire" + user.umpireCustomPhone = "+33612345678" + user.hideUmpireMail = false if let uu = try await StoreCenter.main.service().put(user) { assert(uu.summonsMessageBody == user.summonsMessageBody) @@ -77,6 +86,16 @@ final class UserDataTests: XCTestCase { assert(uu.groupStageMatchFormatPreference == user.groupStageMatchFormatPreference) assert(uu.loserBracketMatchFormatPreference == user.loserBracketMatchFormatPreference) assert(uu.loserBracketMode == user.loserBracketMode) + assert(uu.disableRankingFederalRuling == user.disableRankingFederalRuling) + assert(uu.deviceId == user.deviceId) + assert(uu.agents == user.agents) + assert(uu.userRole == user.userRole) + assert(uu.registrationPaymentMode == user.registrationPaymentMode) + assert(uu.umpireCustomMail == user.umpireCustomMail) + assert(uu.umpireCustomContact == user.umpireCustomContact) + assert(uu.umpireCustomPhone == user.umpireCustomPhone) + assert(uu.hideUmpireMail == user.hideUmpireMail) + assert(uu.hideUmpirePhone == user.hideUmpirePhone) } else { XCTFail("missing data") }