|
|
|
|
@ -22,6 +22,8 @@ struct SynchronizationTests { |
|
|
|
|
self.secondStoreCenter.configureURLs(secureScheme: false, domain: "127.0.0.1:8000", webSockets: false) |
|
|
|
|
self.secondStoreCenter.tokenKeychain = MockKeychainStore(fileName: "storage-2/token.json") |
|
|
|
|
self.secondStoreCenter.deviceKeychain = MockKeychainStore(fileName: "storage-2/device.json") |
|
|
|
|
try self.secondStoreCenter.deviceKeychain.add(value: UUID().uuidString) |
|
|
|
|
|
|
|
|
|
self.secondStoreCenter.classProject = "PadelClubData" |
|
|
|
|
|
|
|
|
|
let token2 = try? self.secondStoreCenter.rawTokenShouldNotBeUsed() |
|
|
|
|
@ -32,6 +34,7 @@ struct SynchronizationTests { |
|
|
|
|
StoreCenter.main.configureURLs(secureScheme: false, domain: "127.0.0.1:8000", webSockets: false) |
|
|
|
|
StoreCenter.main.tokenKeychain = MockKeychainStore(fileName: "storage/token.json") |
|
|
|
|
StoreCenter.main.deviceKeychain = MockKeychainStore(fileName: "storage/device.json") |
|
|
|
|
try StoreCenter.main.deviceKeychain.add(value: UUID().uuidString) |
|
|
|
|
StoreCenter.main.classProject = "PadelClubData" |
|
|
|
|
|
|
|
|
|
let token = try? StoreCenter.main.rawTokenShouldNotBeUsed() |
|
|
|
|
@ -44,6 +47,11 @@ struct SynchronizationTests { |
|
|
|
|
let _: CustomUser = try await storeCenter.service().login(username: self.username, password: self.password) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test("device id tests") |
|
|
|
|
func testDeviceIds() async throws { |
|
|
|
|
#expect(StoreCenter.main.deviceId() != self.secondStoreCenter.deviceId()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test func testAuthentication() { |
|
|
|
|
#expect(StoreCenter.main.isAuthenticated) |
|
|
|
|
#expect(self.secondStoreCenter.isAuthenticated) |
|
|
|
|
@ -75,8 +83,8 @@ struct SynchronizationTests { |
|
|
|
|
try await eventCollection1.loadDataFromServerIfAllowed(clear: true) |
|
|
|
|
#expect(eventCollection1.count == 1) |
|
|
|
|
|
|
|
|
|
try await eventCollection2.loadDataFromServerIfAllowed(clear: true) |
|
|
|
|
#expect(eventCollection2.count == 1) |
|
|
|
|
// try await eventCollection2.loadDataFromServerIfAllowed(clear: true) |
|
|
|
|
// #expect(eventCollection2.count == 1) |
|
|
|
|
|
|
|
|
|
try await self.secondStoreCenter.testSynchronizeOnceAsync() |
|
|
|
|
#expect(eventCollection2.count == 1) |
|
|
|
|
|