Fix test build

sync3
Laurent 6 months ago
parent 435fa59d58
commit f3b420cd44
  1. 8
      PadelClubDataTests/DataAccessSyncTests.swift
  2. 22
      PadelClubDataTests/SynchronizationTests.swift

@ -69,10 +69,10 @@ struct DataAccessSyncTests {
} }
// Setup // Setup
let eventColA: SyncedCollection<Event> = await StoreCenter.main.mainStore.synchronizedCollectionWithFileLoading() let eventColA: SyncedCollection<Event> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
let tournamentColA: SyncedCollection<Tournament> = await StoreCenter.main.mainStore.synchronizedCollectionWithFileLoading() let tournamentColA: SyncedCollection<Tournament> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
let eventColB: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.synchronizedCollectionWithFileLoading() let eventColB: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.asyncLoadingSynchronizedCollection()
let tournamentColB: SyncedCollection<Tournament> = await self.secondStoreCenter.mainStore.synchronizedCollectionWithFileLoading() let tournamentColB: SyncedCollection<Tournament> = await self.secondStoreCenter.mainStore.asyncLoadingSynchronizedCollection()
await eventColA.deleteAsync(contentOfs: Array(eventColA)) await eventColA.deleteAsync(contentOfs: Array(eventColA))
await tournamentColA.deleteAsync(contentOfs: Array(tournamentColA)) await tournamentColA.deleteAsync(contentOfs: Array(tournamentColA))

@ -52,7 +52,7 @@ struct SynchronizationTests {
let _: CustomUser = try await storeCenter.service().login(username: self.username, password: self.password) let _: CustomUser = try await storeCenter.service().login(username: self.username, password: self.password)
} }
@Test("device id tests") @Test
func testDeviceIds() async throws { func testDeviceIds() async throws {
#expect(StoreCenter.main.deviceId() != self.secondStoreCenter.deviceId()) #expect(StoreCenter.main.deviceId() != self.secondStoreCenter.deviceId())
} }
@ -69,12 +69,12 @@ struct SynchronizationTests {
} }
// Cleanup // Cleanup
let eventCollection1: SyncedCollection<Event> = await StoreCenter.main.mainStore.synchronizedCollectionWithFileLoading() let eventCollection1: SyncedCollection<Event> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
#expect(eventCollection1.hasLoaded == true) #expect(eventCollection1.hasLoaded == true)
await eventCollection1.deleteAsync(contentOfs: Array(eventCollection1)) await eventCollection1.deleteAsync(contentOfs: Array(eventCollection1))
let eventCollection2: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.synchronizedCollectionWithFileLoading() let eventCollection2: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.asyncLoadingSynchronizedCollection()
#expect(eventCollection2.hasLoaded == true) #expect(eventCollection2.hasLoaded == true)
eventCollection2.clear() eventCollection2.clear()
@ -114,15 +114,15 @@ struct SynchronizationTests {
} }
// Setup events collections // Setup events collections
let eventCollectionA: SyncedCollection<Event> = await StoreCenter.main.mainStore.synchronizedCollectionWithFileLoading() let eventCollectionA: SyncedCollection<Event> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
await eventCollectionA.deleteAsync(contentOfs: Array(eventCollectionA)) await eventCollectionA.deleteAsync(contentOfs: Array(eventCollectionA))
let eventCollectionB: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.synchronizedCollectionWithFileLoading() let eventCollectionB: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.asyncLoadingSynchronizedCollection()
eventCollectionB.clear() eventCollectionB.clear()
// Setup clubs collections // Setup clubs collections
let clubCollectionA: SyncedCollection<Club> = await StoreCenter.main.mainStore.synchronizedCollectionWithFileLoading() let clubCollectionA: SyncedCollection<Club> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
await clubCollectionA.deleteAsync(contentOfs: Array(clubCollectionA)) await clubCollectionA.deleteAsync(contentOfs: Array(clubCollectionA))
let clubCollectionB: SyncedCollection<Club> = await self.secondStoreCenter.mainStore.synchronizedCollectionWithFileLoading() let clubCollectionB: SyncedCollection<Club> = await self.secondStoreCenter.mainStore.asyncLoadingSynchronizedCollection()
clubCollectionB.clear() clubCollectionB.clear()
// cleanup sync residues // cleanup sync residues
@ -178,9 +178,9 @@ struct SynchronizationTests {
let tournament = Tournament() let tournament = Tournament()
// Setup TeamReg // Setup TeamReg
let teamRegColA: SyncedCollection<TeamRegistration> = await StoreCenter.main.mainStore.synchronizedCollectionWithFileLoading() let teamRegColA: SyncedCollection<TeamRegistration> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
await teamRegColA.deleteAsync(contentOfs: Array(teamRegColA)) await teamRegColA.deleteAsync(contentOfs: Array(teamRegColA))
let teamRegColB: SyncedCollection<TeamRegistration> = await self.secondStoreCenter.mainStore.synchronizedCollectionWithFileLoading() let teamRegColB: SyncedCollection<TeamRegistration> = await self.secondStoreCenter.mainStore.asyncLoadingSynchronizedCollection()
teamRegColB.clear() teamRegColB.clear()
// cleanup sync residues // cleanup sync residues
@ -204,9 +204,9 @@ struct SynchronizationTests {
} }
// Setup events collections // Setup events collections
let eventCollectionA: SyncedCollection<Event> = await StoreCenter.main.mainStore.synchronizedCollectionWithFileLoading() let eventCollectionA: SyncedCollection<Event> = await StoreCenter.main.mainStore.asyncLoadingSynchronizedCollection()
await eventCollectionA.deleteAsync(contentOfs: Array(eventCollectionA)) await eventCollectionA.deleteAsync(contentOfs: Array(eventCollectionA))
let eventCollectionB: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.synchronizedCollectionWithFileLoading() let eventCollectionB: SyncedCollection<Event> = await self.secondStoreCenter.mainStore.asyncLoadingSynchronizedCollection()
eventCollectionB.clear() eventCollectionB.clear()
// cleanup sync residues // cleanup sync residues

Loading…
Cancel
Save