sync_v2
Laurent 7 months ago
parent af5c677ded
commit cf4d26370a
  1. 2
      LeStorage/ApiCallCollection.swift
  2. 5
      LeStorageTests/ApiCallTests.swift
  3. 7
      LeStorageTests/CollectionsTests.swift
  4. 1
      LeStorageTests/IdentifiableTests.swift
  5. 1
      LeStorageTests/StoredCollectionTests.swift

@ -318,7 +318,7 @@ actor ApiCallCollection<T: SyncedStorable>: SomeCallCollection {
} }
/// Sends a GET request with an optional [storeId] /// Sends a GET request with an optional [storeId]
func sendGetRequest(storeId: String?, clear: Bool) async throws { func sendGetRequest(storeId: String?, clear: Bool = true) async throws {
var parameters: [String : String]? = nil var parameters: [String : String]? = nil
if let storeId { if let storeId {
parameters = [Services.storeIdURLParameter : storeId] parameters = [Services.storeIdURLParameter : storeId]

@ -9,13 +9,16 @@ import Testing
@testable import LeStorage @testable import LeStorage
class Thing: SyncedModelObject, SyncedStorable, URLParameterConvertible { class Thing: SyncedModelObject, SyncedStorable, URLParameterConvertible {
override required init() {
super.init()
}
static func resourceName() -> String { return "thing" } static func resourceName() -> String { return "thing" }
static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { return [] } static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { return [] }
static func filterByStoreIdentifier() -> Bool { return false } static func filterByStoreIdentifier() -> Bool { return false }
var id: String = Store.randomId() var id: String = Store.randomId()
var name: String var name: String = ""
init(name: String) { init(name: String) {
self.name = name self.name = name

@ -24,7 +24,11 @@ class Boat: ModelObject, SyncedStorable {
var id: String = Store.randomId() var id: String = Store.randomId()
var lastUpdate: Date = Date() var lastUpdate: Date = Date()
var shared: Bool? var shared: Bool? = false
override required init() {
super.init()
}
static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { return [] } static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { return [] }
static func resourceName() -> String { return "boat" } static func resourceName() -> String { return "boat" }
@ -61,6 +65,7 @@ struct CollectionsTests {
// Wait a bit before checking again // Wait a bit before checking again
try await Task.sleep(for: .milliseconds(100)) try await Task.sleep(for: .milliseconds(100))
} }
collection.reset()
} }
@Test func differentiationTest() async throws { @Test func differentiationTest() async throws {

@ -74,6 +74,7 @@ struct IdentifiableTests {
// Wait a bit before checking again // Wait a bit before checking again
try await Task.sleep(for: .milliseconds(100)) try await Task.sleep(for: .milliseconds(100))
} }
collection.reset()
} }
@Test func testIntIds() async throws { @Test func testIntIds() async throws {

@ -38,6 +38,7 @@ struct StoredCollectionTests {
// Wait a bit before checking again // Wait a bit before checking again
try await Task.sleep(for: .milliseconds(100)) try await Task.sleep(for: .milliseconds(100))
} }
collection.reset()
} }
@Test func testInitialization() async throws { @Test func testInitialization() async throws {

Loading…
Cancel
Save