Adds test for fields in user

multistore
Laurent 2 years ago
parent 8c4fe2a7b5
commit 1fa4d0ab62
  1. 1
      PadelClubTests/TokenExemptionTests.swift
  2. 35
      PadelClubTests/UserDataTests.swift

@ -50,7 +50,6 @@ final class TokenExemptionTests: XCTestCase {
}
func login() async throws -> User {
// print("LOGIN!")
let user: User = try await Store.main.service().login(username: self.username, password: self.password)
return user
}

@ -36,4 +36,39 @@ final class UserDataTests: XCTestCase {
}
func login() async throws -> User {
let user: User = try await Store.main.service().login(username: self.username, password: self.password)
return user
}
func testUserUpdate() async throws {
let user = try await self.login()
user.summonsMessageBody = "hello"
user.summonsMessageSignature = "jean coco"
user.summonsAvailablePaymentMethods = "cash"
user.summonsDisplayFormat = true
user.summonsDisplayEntryFee = true
user.summonsUseFullCustomMessage = true
user.matchFormatsDefaultDuration = [MatchFormat.nineGames : 1]
user.bracketMatchFormatPreference = MatchFormat.superTie
user.groupStageMatchFormatPreference = MatchFormat.twoSets
user.loserBracketMatchFormatPreference = MatchFormat.twoSetsOfFourGames
let uu = try await Store.main.service().put(user)
assert(uu.summonsMessageBody == user.summonsMessageBody)
assert(uu.summonsMessageSignature == user.summonsMessageSignature)
assert(uu.summonsAvailablePaymentMethods == user.summonsAvailablePaymentMethods)
assert(uu.summonsDisplayFormat == user.summonsDisplayFormat)
assert(uu.summonsDisplayEntryFee == user.summonsDisplayEntryFee)
assert(uu.summonsUseFullCustomMessage == user.summonsUseFullCustomMessage)
assert(uu.matchFormatsDefaultDuration == user.matchFormatsDefaultDuration)
assert(uu.bracketMatchFormatPreference == user.bracketMatchFormatPreference)
assert(uu.groupStageMatchFormatPreference == user.groupStageMatchFormatPreference)
assert(uu.loserBracketMatchFormatPreference == user.loserBracketMatchFormatPreference)
}
}

Loading…
Cancel
Save