diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index a09064b..ad789ed 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ C411C9C32BEBA453003017AD /* ServerDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C411C9C22BEBA453003017AD /* ServerDataTests.swift */; }; + C411C9C92BF219CB003017AD /* UserDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C411C9C82BF219CB003017AD /* UserDataTests.swift */; }; C425D4012B6D249D002A7B48 /* PadelClubApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C425D4002B6D249D002A7B48 /* PadelClubApp.swift */; }; C425D4052B6D249E002A7B48 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C425D4042B6D249E002A7B48 /* Assets.xcassets */; }; C425D4082B6D249E002A7B48 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C425D4072B6D249E002A7B48 /* Preview Assets.xcassets */; }; @@ -302,6 +303,8 @@ /* Begin PBXFileReference section */ C411C9C22BEBA453003017AD /* ServerDataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerDataTests.swift; sourceTree = ""; }; + C411C9C82BF219CB003017AD /* UserDataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDataTests.swift; sourceTree = ""; }; + C411C9CC2BF21DAF003017AD /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; C425D3FD2B6D249D002A7B48 /* PadelClub.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PadelClub.app; sourceTree = BUILT_PRODUCTS_DIR; }; C425D4002B6D249D002A7B48 /* PadelClubApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PadelClubApp.swift; sourceTree = ""; }; C425D4042B6D249E002A7B48 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -648,6 +651,7 @@ C425D4112B6D249E002A7B48 /* PadelClubTests.swift */, C49EF0412BE23BF50077B5AA /* PaymentTests.swift */, C411C9C22BEBA453003017AD /* ServerDataTests.swift */, + C411C9C82BF219CB003017AD /* UserDataTests.swift */, ); path = PadelClubTests; sourceTree = ""; @@ -672,6 +676,7 @@ C4A47D5F2B6D3B2D00ADC637 /* Data */ = { isa = PBXGroup; children = ( + C411C9CC2BF21DAF003017AD /* README.md */, C4A47D5D2B6D38EC00ADC637 /* DataStore.swift */, C4A47DAC2B85FCCD00ADC637 /* User.swift */, C4A47D592B6D383C00ADC637 /* Tournament.swift */, @@ -1640,6 +1645,7 @@ files = ( C49EF0422BE23BF50077B5AA /* PaymentTests.swift in Sources */, C425D4122B6D249E002A7B48 /* PadelClubTests.swift in Sources */, + C411C9C92BF219CB003017AD /* UserDataTests.swift in Sources */, C411C9C32BEBA453003017AD /* ServerDataTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/PadelClub/Data/Club.swift b/PadelClub/Data/Club.swift index 6836fb8..8439e10 100644 --- a/PadelClub/Data/Club.swift +++ b/PadelClub/Data/Club.swift @@ -13,6 +13,7 @@ import LeStorage class Club : ModelObject, Storable, Hashable { static func resourceName() -> String { return "clubs" } + static func requestsRequiresToken() -> Bool { return false } static func == (lhs: Club, rhs: Club) -> Bool { lhs.id == rhs.id diff --git a/PadelClub/Data/Court.swift b/PadelClub/Data/Court.swift index add8cce..0ace2b0 100644 --- a/PadelClub/Data/Court.swift +++ b/PadelClub/Data/Court.swift @@ -12,7 +12,8 @@ import LeStorage @Observable class Court : ModelObject, Storable, Hashable { static func resourceName() -> String { return "courts" } - + static func requestsRequiresToken() -> Bool { return true } + static func == (lhs: Court, rhs: Court) -> Bool { lhs.id == rhs.id } diff --git a/PadelClub/Data/DateInterval.swift b/PadelClub/Data/DateInterval.swift index cde3b71..ebd1002 100644 --- a/PadelClub/Data/DateInterval.swift +++ b/PadelClub/Data/DateInterval.swift @@ -12,7 +12,8 @@ import LeStorage @Observable class DateInterval: ModelObject, Storable { static func resourceName() -> String { return "date-intervals" } - + static func requestsRequiresToken() -> Bool { return true } + var id: String = Store.randomId() var event: String var courtIndex: Int diff --git a/PadelClub/Data/Event.swift b/PadelClub/Data/Event.swift index 3ecf737..2e9e5a8 100644 --- a/PadelClub/Data/Event.swift +++ b/PadelClub/Data/Event.swift @@ -12,7 +12,8 @@ import SwiftUI @Observable class Event: ModelObject, Storable { static func resourceName() -> String { return "events" } - + static func requestsRequiresToken() -> Bool { return true } + var id: String = Store.randomId() var creator: String? var club: String? diff --git a/PadelClub/Data/Federal/FederalPlayer.swift b/PadelClub/Data/Federal/FederalPlayer.swift index fde88d1..60d2c9d 100644 --- a/PadelClub/Data/Federal/FederalPlayer.swift +++ b/PadelClub/Data/Federal/FederalPlayer.swift @@ -139,7 +139,7 @@ struct FederalPlayer: Decodable { $0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty })) - print(result) +// print(result) if result.count < 11 { return nil } diff --git a/PadelClub/Data/GroupStage.swift b/PadelClub/Data/GroupStage.swift index 3345109..39f7428 100644 --- a/PadelClub/Data/GroupStage.swift +++ b/PadelClub/Data/GroupStage.swift @@ -13,7 +13,8 @@ import SwiftUI @Observable class GroupStage: ModelObject, Storable { static func resourceName() -> String { "group-stages" } - + static func requestsRequiresToken() -> Bool { return true } + var id: String = Store.randomId() var tournament: String var index: Int diff --git a/PadelClub/Data/Match.swift b/PadelClub/Data/Match.swift index 78c21fd..c189f4b 100644 --- a/PadelClub/Data/Match.swift +++ b/PadelClub/Data/Match.swift @@ -11,6 +11,8 @@ import LeStorage @Observable class Match: ModelObject, Storable { static func resourceName() -> String { "matches" } + static func requestsRequiresToken() -> Bool { return true } + var byeState: Bool = false var id: String = Store.randomId() diff --git a/PadelClub/Data/MonthData.swift b/PadelClub/Data/MonthData.swift index 0bb8d46..4820548 100644 --- a/PadelClub/Data/MonthData.swift +++ b/PadelClub/Data/MonthData.swift @@ -13,7 +13,8 @@ import LeStorage class MonthData : ModelObject, Storable { static func resourceName() -> String { return "month-data" } - + static func requestsRequiresToken() -> Bool { return false } + private(set) var id: String = Store.randomId() private(set) var monthKey: String private(set) var creationDate: Date diff --git a/PadelClub/Data/PlayerRegistration.swift b/PadelClub/Data/PlayerRegistration.swift index ad5d708..e2a8aa2 100644 --- a/PadelClub/Data/PlayerRegistration.swift +++ b/PadelClub/Data/PlayerRegistration.swift @@ -11,6 +11,7 @@ import LeStorage @Observable class PlayerRegistration: ModelObject, Storable { static func resourceName() -> String { "player-registrations" } + static func requestsRequiresToken() -> Bool { return true } var id: String = Store.randomId() var teamRegistration: String? diff --git a/PadelClub/Data/README.md b/PadelClub/Data/README.md new file mode 100644 index 0000000..9a5a878 --- /dev/null +++ b/PadelClub/Data/README.md @@ -0,0 +1,16 @@ +# Procédure d'ajout de champ dans une classe + +Dans Swift: +- Ajouter le champ dans classe +- Ajouter le champ dans le constructeur si possible +- Ajouter la codingKey correspondante +- Pour la classe **Tournament**, ajouter le champ dans l'encoding/decoding +- Ouvrir **ServerDataTests** et ajouter un test sur le champ + +Dans Django: +- Ajouter le champ dans la classe +- Faire le *makemigrations* + *migrate* +- S'il c'est un champ dans **CustomUser**, s’assurer que ca casse pas la creation de user dans serializers.py + +Enfin, revenir dans Xcode, ouvrir ServerDataTests et lancer le test mis à jour + diff --git a/PadelClub/Data/Round.swift b/PadelClub/Data/Round.swift index a9875e0..323da8d 100644 --- a/PadelClub/Data/Round.swift +++ b/PadelClub/Data/Round.swift @@ -12,7 +12,8 @@ import SwiftUI @Observable class Round: ModelObject, Storable { static func resourceName() -> String { "rounds" } - + static func requestsRequiresToken() -> Bool { return true } + var id: String = Store.randomId() var tournament: String var index: Int diff --git a/PadelClub/Data/TeamRegistration.swift b/PadelClub/Data/TeamRegistration.swift index 6136973..562680f 100644 --- a/PadelClub/Data/TeamRegistration.swift +++ b/PadelClub/Data/TeamRegistration.swift @@ -11,7 +11,8 @@ import LeStorage @Observable class TeamRegistration: ModelObject, Storable { static func resourceName() -> String { "team-registrations" } - + static func requestsRequiresToken() -> Bool { return true } + var id: String = Store.randomId() var tournament: String var groupStage: String? @@ -29,11 +30,11 @@ class TeamRegistration: ModelObject, Storable { var wildCardBracket: Bool = false var wildCardGroupStage: Bool = false var weight: Int = 0 - var lockWeight: Int? + var lockedWeight: Int? var confirmationDate: Date? var qualified: Bool = false - init(tournament: String, groupStage: String? = nil, registrationDate: Date? = nil, callDate: Date? = nil, bracketPosition: Int? = nil, groupStagePosition: Int? = nil, comment: String? = nil, source: String? = nil, sourceValue: String? = nil, logo: String? = nil, name: String? = nil, walkOut: Bool = false, wildCardBracket: Bool = false, wildCardGroupStage: Bool = false, weight: Int = 0, lockWeight: Int? = nil, confirmationDate: Date? = nil, qualified: Bool = false) { + init(tournament: String, groupStage: String? = nil, registrationDate: Date? = nil, callDate: Date? = nil, bracketPosition: Int? = nil, groupStagePosition: Int? = nil, comment: String? = nil, source: String? = nil, sourceValue: String? = nil, logo: String? = nil, name: String? = nil, walkOut: Bool = false, wildCardBracket: Bool = false, wildCardGroupStage: Bool = false, weight: Int = 0, lockedWeight: Int? = nil, confirmationDate: Date? = nil, qualified: Bool = false) { self.tournament = tournament self.groupStage = groupStage self.registrationDate = registrationDate @@ -49,7 +50,7 @@ class TeamRegistration: ModelObject, Storable { self.wildCardBracket = wildCardBracket self.wildCardGroupStage = wildCardGroupStage self.weight = weight - self.lockWeight = lockWeight + self.lockedWeight = lockedWeight self.confirmationDate = confirmationDate self.qualified = qualified } @@ -65,7 +66,7 @@ class TeamRegistration: ModelObject, Storable { var initialWeight: Int { - lockWeight ?? weight + lockedWeight ?? weight } func called() -> Bool { @@ -342,7 +343,7 @@ class TeamRegistration: ModelObject, Storable { case _wildCardGroupStage = "wildCardGroupStage" case _weight = "weight" case _walkOut = "walkOut" - case _lockWeight = "lockWeight" + case _lockedWeight = "lockedWeight" case _confirmationDate = "confirmationDate" case _qualified = "qualified" } diff --git a/PadelClub/Data/TeamScore.swift b/PadelClub/Data/TeamScore.swift index 3b01c8b..5f36e1d 100644 --- a/PadelClub/Data/TeamScore.swift +++ b/PadelClub/Data/TeamScore.swift @@ -12,6 +12,7 @@ import LeStorage class TeamScore: ModelObject, Storable { static func resourceName() -> String { "team-scores" } + static func requestsRequiresToken() -> Bool { return true } var id: String = Store.randomId() var match: String diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index dacf919..b9a5a2a 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -11,7 +11,8 @@ import LeStorage @Observable class Tournament : ModelObject, Storable { static func resourceName() -> String { "tournaments" } - + static func requestsRequiresToken() -> Bool { return true } + var id: String = Store.randomId() var event: String? var name: String? @@ -839,7 +840,7 @@ class Tournament : ModelObject, Storable { } let teams = unsortedTeams() teams.forEach { team in - team.lockWeight = team.weight + team.lockedWeight = team.weight } try? DataStore.shared.teamRegistrations.addOrUpdate(contentOfs: teams) } diff --git a/PadelClub/Data/User.swift b/PadelClub/Data/User.swift index 65b2d85..88fec23 100644 --- a/PadelClub/Data/User.swift +++ b/PadelClub/Data/User.swift @@ -15,11 +15,12 @@ enum UserRight: Int, Codable { } @Observable -class User: UserBase, Storable { +class User: ModelObject, UserBase, Storable { static func resourceName() -> String { "users" } - - func deleteDependencies() throws { } + static func requestsRequiresToken() -> Bool { return false } + +// func deleteDependencies() throws { } public var id: String = Store.randomId() public var username: String diff --git a/PadelClub/Views/Subscription/Purchase.swift b/PadelClub/Views/Subscription/Purchase.swift index 00f8a24..aeab9aa 100644 --- a/PadelClub/Views/Subscription/Purchase.swift +++ b/PadelClub/Views/Subscription/Purchase.swift @@ -8,18 +8,19 @@ import Foundation import LeStorage -public class Purchase: ModelObject, Storable { - public static func resourceName() -> String { return "purchases" } +class Purchase: ModelObject, Storable { + static func resourceName() -> String { return "purchases" } + static func requestsRequiresToken() -> Bool { return true } - public var id: String = Store.randomId() + var id: String = Store.randomId() - public var user: String - public var identifier: UInt64 - public var purchaseDate: Date - public var productId: String - public var quantity: Int? + var user: String + var identifier: UInt64 + var purchaseDate: Date + var productId: String + var quantity: Int? - public init(user: String, identifier: UInt64, purchaseDate: Date, productId: String, quantity: Int? = nil) { + init(user: String, identifier: UInt64, purchaseDate: Date, productId: String, quantity: Int? = nil) { self.user = user self.identifier = identifier self.purchaseDate = purchaseDate diff --git a/PadelClub/Views/Subscription/SubscriptionView.swift b/PadelClub/Views/Subscription/SubscriptionView.swift index 9e4b7f0..eb4a17d 100644 --- a/PadelClub/Views/Subscription/SubscriptionView.swift +++ b/PadelClub/Views/Subscription/SubscriptionView.swift @@ -78,7 +78,7 @@ class SubscriptionModel: ObservableObject, StoreDelegate { } Task { if product.item.isConsumable { - if let result = try await self.storeManager?.purchase(product, quantity: self.quantity) { + if let _ = try await self.storeManager?.purchase(product, quantity: self.quantity) { self.showSuccessfulPurchaseView = true } } else { diff --git a/PadelClub/Views/Tournament/Screen/Components/UpdateSourceRankDateView.swift b/PadelClub/Views/Tournament/Screen/Components/UpdateSourceRankDateView.swift index e6ed2c1..c06c505 100644 --- a/PadelClub/Views/Tournament/Screen/Components/UpdateSourceRankDateView.swift +++ b/PadelClub/Views/Tournament/Screen/Components/UpdateSourceRankDateView.swift @@ -48,7 +48,7 @@ struct UpdateSourceRankDateView: View { tournament.unsortedTeams().forEach { team in team.setWeight(from: team.players(), inTournamentCategory: tournament.tournamentCategory) if forceRefreshLockWeight { - team.lockWeight = team.weight + team.lockedWeight = team.weight } } diff --git a/PadelClubTests/ServerDataTests.swift b/PadelClubTests/ServerDataTests.swift index 977e025..777e36f 100644 --- a/PadelClubTests/ServerDataTests.swift +++ b/PadelClubTests/ServerDataTests.swift @@ -12,16 +12,28 @@ import LeStorage final class ServerDataTests: XCTestCase { let username: String = "test" - + let password: String = "MyPass1234--" override func setUpWithError() throws { Store.main.synchronizationApiURL = "http://127.0.0.1:8000/api/" + Task { + do { + try await self.login() + } catch { + assertionFailure(error.localizedDescription) + } + } } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. } - + + func login() async throws { +// print("LOGIN!") + let _: User = try await Store.main.service().login(username: self.username, password: self.password) + } + func testClub() async throws { let club = Club(name: "Aix Universite Club") @@ -50,45 +62,13 @@ final class ServerDataTests: XCTestCase { } - func testUserCreation() async throws { - - let userCreationForm = UserCreationForm(username: self.username, password: "MyPass1234--", firstName: "jean", lastName: "coco", email: "laurent@staxriver.com", phone: "0123", country: "France") - let user: User = try await Store.main.service().createAccount(user: userCreationForm) - - assert(user.username == userCreationForm.username) - assert(user.firstName == userCreationForm.firstName) - assert(user.lastName == userCreationForm.lastName) - assert(user.email == userCreationForm.email) - assert(user.phone == userCreationForm.phone) - assert(user.country == userCreationForm.country) - - } - - func createUser() async throws -> User { - let userCreationForm = UserCreationForm(username: "test", password: "MyPass1234--", firstName: "jean", lastName: "coco", email: "laurent@staxriver.com", phone: "0123", country: "France") - return try await Store.main.service().createAccount(user: userCreationForm) - } - func testLogin() async throws { - - let user: User = try await Store.main.service().login(username: "test", password: "MyPass1234--") + let user: User = try await Store.main.service().login(username: self.username, password: self.password) assert(user.username == "test") - - } - - func login() async throws { - let _: User = try await Store.main.service().login(username: "test", password: "MyPass1234--") } func testEvent() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - guard let userId = Store.main.currentUserUUID?.uuidString else { assertionFailure("missing user UUID") return @@ -110,13 +90,6 @@ final class ServerDataTests: XCTestCase { func testTournament() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let event: [Event] = try await Store.main.service().get() guard let eventId = event.first?.id else { assertionFailure("missing event in database") @@ -159,13 +132,6 @@ final class ServerDataTests: XCTestCase { func testGroupStage() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let tournament: [Tournament] = try await Store.main.service().get() guard let tournamentId = tournament.first?.id else { assertionFailure("missing tournament in database") @@ -186,13 +152,6 @@ final class ServerDataTests: XCTestCase { func testRound() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let tournament: [Tournament] = try await Store.main.service().get() guard let tournamentId = tournament.first?.id else { assertionFailure("missing tournament in database") @@ -214,13 +173,6 @@ final class ServerDataTests: XCTestCase { func testTeamRegistration() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let tournament: [Tournament] = try await Store.main.service().get() guard let tournamentId = tournament.first?.id else { assertionFailure("missing tournament in database") @@ -232,7 +184,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, lockWeight: 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) let tr: TeamRegistration = try await Store.main.service().post(teamRegistration) @@ -251,21 +203,14 @@ final class ServerDataTests: XCTestCase { assert(tr.wildCardBracket == teamRegistration.wildCardBracket) assert(tr.wildCardGroupStage == teamRegistration.wildCardGroupStage) assert(tr.weight == teamRegistration.weight) - assert(tr.lockWeight == teamRegistration.lockWeight) -// assert(tr.confirmationDate != nil) + assert(tr.lockedWeight == teamRegistration.lockedWeight) + assert(tr.confirmationDate?.formatted() == teamRegistration.confirmationDate?.formatted()) assert(tr.qualified == teamRegistration.qualified) } func testPlayerRegistration() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let teamRegistrations: [TeamRegistration] = try await Store.main.service().get() guard let teamRegistrationId = teamRegistrations.first?.id else { assertionFailure("missing teamRegistrations in database") @@ -297,13 +242,6 @@ final class ServerDataTests: XCTestCase { func testMatch() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let teamRegistrations: [TeamRegistration] = try await Store.main.service().get() guard let teamRegistrationId = teamRegistrations.first?.id else { assertionFailure("missing teamRegistrations in database") @@ -331,13 +269,6 @@ final class ServerDataTests: XCTestCase { func testTeamScore() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let matches: [Match] = try await Store.main.service().get() guard let matchId = matches.first?.id else { assertionFailure("missing match in database") @@ -364,15 +295,7 @@ final class ServerDataTests: XCTestCase { } func testCourt() async throws { - - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - - + let clubs: [Club] = try await Store.main.service().get() guard let clubId = clubs.first?.id else { assertionFailure("missing club in database") @@ -392,13 +315,6 @@ final class ServerDataTests: XCTestCase { func testDateInterval() async throws { - do { - try await self.login() - } catch { - let _ = try await self.createUser() - try await self.login() - } - let event: [Event] = try await Store.main.service().get() guard let eventId = event.first?.id else { assertionFailure("missing event in database") @@ -414,4 +330,5 @@ final class ServerDataTests: XCTestCase { assert(di.endDate.formatted() == dateInterval.endDate.formatted()) } + } diff --git a/PadelClubTests/UserDataTests.swift b/PadelClubTests/UserDataTests.swift new file mode 100644 index 0000000..dd1a999 --- /dev/null +++ b/PadelClubTests/UserDataTests.swift @@ -0,0 +1,39 @@ +// +// UserDataTests.swift +// PadelClubTests +// +// Created by Laurent Morvillier on 13/05/2024. +// + +import XCTest +import LeStorage +@testable import PadelClub + +final class UserDataTests: XCTestCase { + + let username: String = "test" + let password: String = "MyPass1234--" + + override func setUpWithError() throws { + Store.main.synchronizationApiURL = "http://127.0.0.1:8000/api/" + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testUserCreation() async throws { + + let userCreationForm = UserCreationForm(username: self.username, password: self.password, firstName: "jean", lastName: "coco", email: "laurent@staxriver.com", phone: "0123", country: "France") + let user: User = try await Store.main.service().createAccount(user: userCreationForm) + + assert(user.username == userCreationForm.username) + assert(user.firstName == userCreationForm.firstName) + assert(user.lastName == userCreationForm.lastName) + assert(user.email == userCreationForm.email) + assert(user.phone == userCreationForm.phone) + assert(user.country == userCreationForm.country) + + } + +}