Merge remote-tracking branch 'refs/remotes/origin/main'

newoffer2025
Raz 6 months ago
commit b79b2ecf9f
  1. 22
      PadelClubDataTests/DeletionTests.swift

@ -50,6 +50,28 @@ struct DeletionTests {
let _: CustomUser = try await storeCenter.service().login(username: username, password: password)
}
@Test func testDeleteDependencies() async throws {
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