update test

sync3
Laurent 6 months ago
parent e554999d8a
commit 0f0577da10
  1. 26
      PadelClubDataTests/DeletionTests.swift

@ -50,6 +50,32 @@ struct DeletionTests {
let _: CustomUser = try await storeCenter.service().login(username: username, password: password)
}
@Test func testDeleteDependencies() async throws {
guard let user = StoreCenter.main.userId else {
throw TestError.notAuthenticated
}
let teamRegCol: SyncedCollection<TeamRegistration> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
let playerRegCol: SyncedCollection<PlayerRegistration> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
let tr1 = TeamRegistration(tournament: "1")
let pr11 = PlayerRegistration(teamRegistration: tr1.id, firstName: "a1", lastName: "b1")
let pr12 = PlayerRegistration(teamRegistration: tr1.id, firstName: "a1", lastName: "b2")
let tr2 = TeamRegistration(tournament: "1")
let pr21 = PlayerRegistration(teamRegistration: tr2.id, firstName: "a2", lastName: "b1")
let pr22 = PlayerRegistration(teamRegistration: tr2.id, firstName: "a2", lastName: "b2")
try await teamRegCol.addOrUpdateAsync(contentOfs: [tr1, tr2])
try await playerRegCol.addOrUpdateAsync(contentOfs: [pr11, pr12, pr21, pr22])
try await teamRegCol.deleteAsync(instance: tr1)
#expect(teamRegCol.count == 1)
#expect(playerRegCol.count == 2)
}
/// This test creates a hierarchy of objects and deletes to see if everything has been properly deleted
@Test func testDeleteEventWithDependencies() async throws {

Loading…
Cancel
Save