import Foundation import Testing @testable import EquipoKit import EquipoActivity // Native slice 2: the device's push registration, the gateway it names, tap // routing and the Live Activity's content state. The payloads under // Fixtures/push are the server's goldens (internal/equipo/push/testdata on // push/server 2ea81007), copied byte for byte. private let deviceToken = Data((0..<32).map { UInt8($0) + 0xA0 }) private let startToken = Data((0..<32).map { UInt8($0) }) private let deviceHex = "a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf" private let startHex = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" private let here = "https://oficina.example.test" private func client(_ t: ScriptedTransport, _ bearer: String = "equipo.person.v1.TOKENFIXTURE") -> EquipoClient { EquipoClient(transport: t, token: bearer) } private func registered(_ t: ScriptedTransport) { t.on("POST /push-registrations", .success(APIResponse(status: 200, data: Data(#"{"environment":"production","platform":"ios","live_activities":true,"updated_at":"2026-11-20T10:00:00Z"}"#.utf8)))) } private func json(_ request: APIRequest) throws -> [String: String] { try JSONSerialization.jsonObject(with: try #require(request.body)) as! [String: String] } @MainActor @Suite struct PushRegistrationTests { @Test func lateAttachCannotReplaceTheNextSignIn() async throws { let t = ScriptedTransport(); registered(t) let r = PushRegistrar(environment: .production, platform: .ios) let lifetimes = SignInLifetimes() let old = lifetimes.current await r.deviceTokenChanged(deviceToken) let next = lifetimes.begin() await r.attach(client(t, "new-sign-in"), lifetime: next) let generation = r.generation await r.attach(client(t, "old-sign-in"), lifetime: old) #expect(r.generation == generation) #expect(t.sent("POST /push-registrations").map(\.bearer) == ["new-sign-in"]) } @Test func theBodyIsTheServersShapeInLowercaseHex() throws { let body = PushRegistrationBody(token: PushToken.hex(deviceToken), environment: .production, platform: .ios, startToken: PushToken.hex(startToken)) let sent = try JSONSerialization.jsonObject(with: try EquipoJSON.encoder.encode(body)) as! [String: String] #expect(sent == ["token": deviceHex, "environment": "production", "platform": "ios", "start_token": startHex]) let mac = PushRegistrationBody(token: deviceHex, environment: .production, platform: .macos, startToken: startHex) #expect(mac.startToken == nil, "the server refuses a push-to-start token from a Mac") } @Test func registersOnceTheTokenArrivesWithTheDeviceBearer() async throws { let t = ScriptedTransport(); registered(t) let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(client(t)) #expect(t.requests.isEmpty, "nothing to register before APNs gives a token") await r.deviceTokenChanged(deviceToken) let sent = t.sent("POST /push-registrations") #expect(sent.count == 1) #expect(sent.first?.bearer == "equipo.person.v1.TOKENFIXTURE") #expect(try json(sent[0]) == ["token": deviceHex, "environment": "production", "platform": "ios"]) await r.sync(); await r.deviceTokenChanged(deviceToken) #expect(t.sent("POST /push-registrations").count == 1, "the server has it: not sent again") } @Test func aMacNeverSendsAStartToken() async throws { let t = ScriptedTransport(); registered(t) let r = PushRegistrar(environment: .production, platform: .macos) await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) await r.startTokenChanged(startToken) let sent = t.sent("POST /push-registrations") #expect(sent.count == 1, "a start token is iPhone-only: nothing more to register") #expect(try json(sent[0]) == ["token": deviceHex, "environment": "production", "platform": "macos"]) } @Test func aChangedTokenRegistersAgain() async throws { let t = ScriptedTransport(); registered(t) let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) await r.startTokenChanged(startToken) func latest() throws -> [String: String] { try json(try #require(t.sent("POST /push-registrations").last)) } #expect(t.sent("POST /push-registrations").count == 2) #expect(try latest()["start_token"] == startHex) await r.deviceTokenChanged(startToken) #expect(t.sent("POST /push-registrations").count == 3, "a new APNs token is registered") #expect(try latest()["token"] == startHex) await r.startTokenChanged(deviceToken) #expect(t.sent("POST /push-registrations").count == 4, "a new push-to-start token is registered") #expect(try latest()["start_token"] == deviceHex) } @Test func anotherTeamsSessionRegistersAgainAndNoneStops() async throws { let t = ScriptedTransport(); registered(t) let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) await r.attach(client(t, "equipo.person.v1.OTHER")) #expect(t.sent("POST /push-registrations").map(\.bearer) == ["equipo.person.v1.TOKENFIXTURE", "equipo.person.v1.OTHER"]) await r.attach(nil) await r.startTokenChanged(startToken) #expect(t.sent("POST /push-registrations").count == 2, "signed out: nothing is sent") } @Test func aRegistrationThatDidNotLandIsSentOnTheNextSync() async throws { let t = ScriptedTransport() t.on("POST /push-registrations", .failure(.offline)) registered(t) let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) #expect(t.sent("POST /push-registrations").count == 1) await r.sync() #expect(t.sent("POST /push-registrations").count == 2, "sent again when the app is in front again") await r.sync() #expect(t.sent("POST /push-registrations").count == 2) } @Test func aBuildThatCannotReceivePushesDoesNotRegister() async throws { let t = ScriptedTransport(); registered(t) let r = PushRegistrar(environment: nil, platform: .macos) await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) #expect(t.requests.isEmpty) } @Test func activityTokensFollowTheRegistrationAndStopWhenTheTaskEnded() async throws { let t = ScriptedTransport() t.on("POST /push-registrations/activities", .success(APIResponse(status: 204, data: Data())), .success(APIResponse(status: 409, data: Data(#"{"code":"task_ended","copy_key":"api.task_ended","request_id":"r"}"#.utf8))), .success(APIResponse(status: 204, data: Data()))) let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(client(t)) await r.activityTokenChanged(startToken, task: "tk1", origin: here) #expect(t.sent("POST /push-registrations/activities").isEmpty, "the device registers first") registered(t) await r.deviceTokenChanged(deviceToken) let first = t.sent("POST /push-registrations/activities") #expect(first.count == 1) #expect(try json(first[0]) == ["task_id": "tk1", "token": startHex]) #expect(first[0].bearer == "equipo.person.v1.TOKENFIXTURE") await r.activityTokenChanged(deviceToken, task: "tk2", origin: here) #expect(t.sent("POST /push-registrations/activities").count == 2) await r.sync() #expect(t.sent("POST /push-registrations/activities").count == 2, "an ended task's token is not sent again") await r.activityTokenChanged(startToken, task: "tk3", origin: here) #expect(try json(t.sent("POST /push-registrations/activities")[2])["task_id"] == "tk3") } @Test func aTaskTheServerSaysEndedEndsItsActivityHere() async throws { let t = ScriptedTransport(); registered(t) t.on("POST /push-registrations/activities", .success(APIResponse(status: 409, data: Data(#"{"code":"task_ended","copy_key":"api.task_ended","request_id":"r"}"#.utf8)))) let r = PushRegistrar(environment: .production, platform: .ios) var closed: [String] = [] r.onActivityClosed = { closed.append($0) } await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) await r.activityTokenChanged(startToken, task: "tk1", origin: here) #expect(closed == ["tk1"], "the Lock Screen does not keep a task the server says is over") } @Test func anotherTeamNeverSendsTheLastTeamsActivities() async throws { let a = ScriptedTransport(); registered(a) a.on("POST /push-registrations/activities", .success(APIResponse(status: 204, data: Data()))) let b = ScriptedTransport(origin: URL(string: "https://other.example.test")!); registered(b) b.on("POST /push-registrations/activities", .success(APIResponse(status: 204, data: Data()))) let r = PushRegistrar(environment: .production, platform: .ios) var changes = 0 r.onSessionChanged = { changes += 1 } await r.attach(client(a)) await r.deviceTokenChanged(deviceToken) await r.activityTokenChanged(startToken, task: "tkA", origin: here) await r.attach(client(b, "equipo.person.v1.OTHER")) #expect(changes == 2, "observers deliver their tokens again for each new session") // Team A's activity is still on the device and its observer delivers again. await r.activityTokenChanged(startToken, task: "tkA", origin: here) #expect(b.sent("POST /push-registrations/activities").isEmpty, "team A's activity tokens never go to team B's server") } @Test func afterARelaunchAnotherTeamsActivityIsStillNeverSent() async throws { let b = ScriptedTransport(origin: URL(string: "https://other.example.test")!); registered(b) b.on("POST /push-registrations/activities", .success(APIResponse(status: 204, data: Data()))) // A fresh process: nothing remembered, team B signed in, and team A's // activity survived (its end failed). It is seen for the first time. let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(client(b)) await r.deviceTokenChanged(deviceToken) await r.activityTokenChanged(startToken, task: "tkA", origin: here) #expect(b.sent("POST /push-registrations/activities").isEmpty, "an activity names its team, so it is never adopted") await r.activityTokenChanged(deviceToken, task: "tkB", origin: "https://OTHER.example.test") let own = try #require(b.sent("POST /push-registrations/activities").first, "team B's own activity is sent") #expect(try json(own)["task_id"] == "tkB") } @Test func anActivitySeenBeforeTheSessionIsRestoredIsSentOnceItIs() async throws { let t = ScriptedTransport(); registered(t) t.on("POST /push-registrations/activities", .success(APIResponse(status: 204, data: Data()))) let r = PushRegistrar(environment: .production, platform: .ios) // Cold launch: observation starts before the saved session attaches. await r.activityTokenChanged(startToken, task: "tk1", origin: here) await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) let sent = try #require(t.sent("POST /push-registrations/activities").first, "a push-started activity still gets the server's updates and its end") #expect(try json(sent)["task_id"] == "tk1") } @Test func anActivityThatNamesNoTeamIsNeverSent() async throws { let t = ScriptedTransport(); registered(t) t.on("POST /push-registrations/activities", .success(APIResponse(status: 204, data: Data()))) let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(client(t)) await r.deviceTokenChanged(deviceToken) await r.activityTokenChanged(startToken, task: "tk1", origin: nil) #expect(t.sent("POST /push-registrations/activities").isEmpty) } @Test func aPassSuspendedAcrossASessionChangeSendsNothingMore() async throws { let inner = ScriptedTransport(); registered(inner) inner.on("POST /push-registrations/activities", .success(APIResponse(status: 204, data: Data()))) let gate = GatedTransport(inner: inner, route: "POST /push-registrations/activities") let r = PushRegistrar(environment: .production, platform: .ios) await r.attach(EquipoClient(transport: gate, token: "equipo.person.v1.TOKENFIXTURE")) // Two activities wait for the device's registration. await r.activityTokenChanged(startToken, task: "tk1", origin: here) await r.activityTokenChanged(deviceToken, task: "tk2", origin: here) gate.hold = true // The pass registers the device, then is held on the first activity request. let pass = Task { await r.deviceTokenChanged(deviceToken) } await gate.waitUntilHeld() await r.attach(nil) gate.release() await pass.value let sent = inner.sent("POST /push-registrations/activities") #expect(sent.count == 1, "signed out mid-pass: the second activity is never sent (\(sent.count) requests)") } } /// A transport that holds one route's first request until released. final class GatedTransport: EquipoTransport, @unchecked Sendable { let inner: ScriptedTransport let route: String var origin: URL { inner.origin } private let lock = NSLock() private var waiting: CheckedContinuation? private var heldOnce = false private var heldSignal: CheckedContinuation? private var isHeld = false var hold = false init(inner: ScriptedTransport, route: String) { self.inner = inner; self.route = route } func send(_ request: APIRequest) async throws -> APIResponse { if hold, request.method + " " + request.path == route, !lock.withLock({ heldOnce }) { await withCheckedContinuation { c in lock.withLock { heldOnce = true; isHeld = true; waiting = c; let s = heldSignal; heldSignal = nil; s?.resume() } } } return try await inner.send(request) } func lines(_ request: APIRequest) async throws -> AsyncThrowingStream { try await inner.lines(request) } func waitUntilHeld() async { if lock.withLock({ isHeld }) { return } await withCheckedContinuation { c in let now: Bool = lock.withLock { if isHeld { return true }; heldSignal = c; return false } if now { c.resume() } } } func release() { lock.withLock { let c = waiting; waiting = nil; return c }?.resume() } } @Suite struct PushEnvironmentTests { private func profile(aps: String?) -> Data { let entitlements = aps.map { "aps-environment\($0)" } ?? "" let plist = """ NameEquipo Entitlements\(entitlements)get-task-allow """ // A CMS envelope around it: bytes before and after. return Data([0x30, 0x82, 0x0F, 0xFF]) + Data(plist.utf8) + Data([0xA0, 0x82, 0x00]) } @Test func theGatewayComesFromTheBuild() { #expect(PushEnvironment.resolve(platform: .ios, simulator: false, embeddedProfile: nil, signedEntitlement: nil) == .production, "TestFlight and the App Store strip the profile") #expect(PushEnvironment.resolve(platform: .ios, simulator: false, embeddedProfile: profile(aps: "development"), signedEntitlement: nil) == .development, "an Xcode build on a device") #expect(PushEnvironment.resolve(platform: .ios, simulator: false, embeddedProfile: profile(aps: "production"), signedEntitlement: nil) == .production) #expect(PushEnvironment.resolve(platform: .ios, simulator: false, embeddedProfile: profile(aps: nil), signedEntitlement: nil) == nil, "a profile without push cannot receive any") #expect(PushEnvironment.resolve(platform: .ios, simulator: true, embeddedProfile: nil, signedEntitlement: nil) == .development) #expect(PushEnvironment.resolve(platform: .macos, simulator: false, embeddedProfile: nil, signedEntitlement: "production") == .production, "Developer ID") #expect(PushEnvironment.resolve(platform: .macos, simulator: false, embeddedProfile: nil, signedEntitlement: nil) == nil, "an ad hoc build has no push entitlement") } @Test func thisTestRunnerCannotReceivePushes() { #expect(PushEnvironment.current == nil, "swift test is not signed with the entitlement") } } @Suite struct PushRouteTests { private func userInfo(_ golden: String) throws -> [AnyHashable: Any] { try JSONSerialization.jsonObject(with: Fixture.data("push/" + golden)) as! [AnyHashable: Any] } @Test func aTapOpensTheRightPlace() throws { #expect(PushRoute(userInfo: try userInfo("card")) == .card("c1")) #expect(PushRoute(userInfo: try userInfo("card"))?.destination == Destination(pane: .conversation, cardID: "c1"), "a card alert opens the conversation at the card") #expect(PushRoute(userInfo: try userInfo("reply"))?.destination == Destination(pane: .conversation), "a reply opens the conversation") #expect(PushRoute(userInfo: try userInfo("task-done"))?.destination == Destination(pane: .tasks, taskID: "tk1"), "a task alert opens the task") #expect(PushRoute(userInfo: try userInfo("task-failed")) == .task("tk1")) #expect(PushRoute(userInfo: try userInfo("badge")) == nil, "a badge opens nothing") #expect(PushRoute(userInfo: ["equipo": ["kind": "card", "task_id": "tk1"]]) == .task("tk1")) #expect(PushRoute(userInfo: ["equipo": ["kind": "something_new"]]) == nil) #expect(PushRoute(userInfo: ["equipo": ["kind": "task"]]) == nil) } @Test func aLiveActivityOpensItsTask() { let link = EquipoLink.task("tk1") #expect(link.absoluteString == "works.oficina.equipo://task/tk1") #expect(PushRoute(url: link) == .task("tk1")) #expect(PushRoute(url: URL(string: "https://oficina.example.test/task/tk1")!) == nil) #expect(PushRoute(url: URL(string: "someone-else://task/tk1")!) == nil, "only this app's own links") #expect(PushRoute(url: URL(string: "works.oficina.equipo://card/c1")!) == nil) #expect(PushRoute(url: URL(string: "works.oficina.equipo://task/")!) == nil) } } @Suite struct LiveActivityStateTests { private func aps(_ golden: String) throws -> [String: Any] { let payload = try JSONSerialization.jsonObject(with: Fixture.data("push/" + golden)) as! [String: Any] return payload["aps"] as! [String: Any] } /// ActivityKit decodes the content state with a plain JSONDecoder. private func state(_ golden: String) throws -> EquipoTaskAttributes.ContentState { let raw = try JSONSerialization.data(withJSONObject: try aps(golden)["content-state"]!) return try JSONDecoder().decode(EquipoTaskAttributes.ContentState.self, from: raw) } @Test func theServersGoldensDecode() throws { let start = try aps("activity-start") #expect(start["attributes-type"] as? String == String(describing: EquipoTaskAttributes.self), "push-to-start names this type") let attributes = try JSONDecoder().decode(EquipoTaskAttributes.self, from: JSONSerialization.data(withJSONObject: start["attributes"]!)) #expect(attributes == EquipoTaskAttributes(taskID: "tk1", origin: "https://oficina.example.test")) #expect(try state("activity-start") == .init(taskID: "tk1", title: "Fix login", stage: "in_progress", specialist: "engineering", activity: "Reading README.md", needsYou: "", tone: "positive")) #expect(try state("activity-update").outcome == nil) let needs = try state("activity-needs") #expect(needs.needsYou == "merge"); #expect(needs.tone == "warning"); #expect(needs.stage == "ready_to_merge") #expect(try state("activity-end").outcome == "done") #expect(try state("activity-replaced").outcome == "replaced") } @Test func theStateEncodesAsTheWireDoes() throws { let start = try state("activity-start") let encoded = try JSONSerialization.jsonObject(with: JSONEncoder().encode(start)) as! [String: String] #expect(encoded.keys.sorted() == ["activity", "needs_you", "specialist", "stage", "task_id", "title", "tone"], "no outcome until it ended") #expect(try JSONDecoder().decode(EquipoTaskAttributes.ContentState.self, from: JSONEncoder().encode(try state("activity-end"))).outcome == "done") } @Test func theActivityIsDrawnFromRoster() throws { let running = TaskActivityPresentation(try state("activity-update")) #expect(running.line == "Reading README.md") #expect(running.tone == .positive) #expect(running.specialist == .engineering) #expect(running.track.map(\.state) == [.done, .current, .todo, .todo, .todo]) #expect(running.outcome == nil) #expect(running.url == EquipoLink.task("tk1")) let needs = TaskActivityPresentation(try state("activity-needs")) #expect(needs.needsYou) #expect(needs.tone == .warning, "amber while it needs you") #expect(needs.line == "Needs you") #expect(needs.track.first { $0.state == .current }?.stage == .readyToMerge) #expect(needs.track.first { $0.state == .current }?.tone == .warning) var waitingAnyway = try state("activity-needs"); waitingAnyway.tone = "positive" #expect(TaskActivityPresentation(waitingAnyway).tone == .warning, "a needs-you activity is never green") let done = TaskActivityPresentation(try state("activity-end")) #expect(done.outcome == "Done"); #expect(done.line == "Done"); #expect(!done.needsYou) #expect(done.track.map(\.state) == [.done, .done, .done, .done, .current]) var cancelled = try state("activity-update"); cancelled.stage = "cancelled"; cancelled.outcome = "cancelled" #expect(TaskActivityPresentation(cancelled).track.isEmpty, "a cancelled task has no track") #expect(TaskActivityPresentation(cancelled).line == "Cancelled") var failed = try state("activity-update"); failed.outcome = "failed"; failed.tone = "negative" #expect(TaskActivityPresentation(failed).line == "Stopped") #expect(TaskActivityPresentation(failed).tone == .negative) #expect(TaskActivityPresentation(try state("activity-replaced")).outcome == nil, "a replaced activity is dismissed at once") } @Test func anActivityTheAppKnowsEndedIsEnded() throws { let tasks: ThinList = try Fixture.decode("thin/tasks") let items = tasks.items ?? [] let ended = LiveActivityPolicy.finished(running: ["tkqsrho7oq3n", "tkyiki7muqby", "gone"], tasks: items) #expect(ended == ["tkyiki7muqby": "done"], "only the finished task; one the app cannot see is left to the server") #expect(LiveActivityPolicy.finished(running: ["tkqsrho7oq3n"], tasks: items).isEmpty, "only activities that run") } } /// A fake system: what the app model asked of it. @MainActor final class FakeNotifications: NotificationSystem { var asked = 0 var badges: [Int] = [] var unregistered = 0 func askAndRegister() { asked += 1 } func setBadge(_ count: Int) { badges.append(count) } func unregister() { unregistered += 1 } } @MainActor @Suite struct RemoteRegistrationTests { @Test func signingOutWhileAskingNeverRegistersAfterwards() async { var calls: [String] = [] var release: CheckedContinuation? var asked = 0 let gate = RemoteRegistration( authorize: { asked += 1 if asked == 1 { await withCheckedContinuation { release = $0 } } }, register: { calls.append("register") }, unregister: { calls.append("unregister") }) let asking = gate.request() while release == nil { await Task.yield() } gate.stop() release?.resume() await asking.value #expect(calls == ["unregister"], "a pending permission prompt cannot undo a sign-out") await gate.request().value #expect(calls == ["unregister", "register"], "pairing again registers again") } @Test func signingOutBeforeTheAskStartsNeverRegisters() async { var calls: [String] = [] let gate = RemoteRegistration( authorize: { calls.append("authorize") }, register: { calls.append("register") }, unregister: { calls.append("unregister") }) let queued = gate.request() gate.stop() await queued.value #expect(calls == ["unregister"], "an ask queued before sign-out is stale too") } } @MainActor @Suite struct NotificationPermissionTests { @Test func permissionIsAskedAfterPairingNotBefore() throws { let fake = FakeNotifications() let model = EquipoAppModel(store: MemorySecretStore(), notifications: fake, push: PushRegistrar(environment: nil)) #expect(fake.asked == 0, "no team yet: nothing is asked at launch") var account = DeviceAccount.new(origin: URL(string: "https://oficina.example.test")!, label: "Test") account.credential = try Fixture.decode("device-credential") model.adopt(account, transport: ScriptedTransport()) #expect(fake.asked == 1, "asked once the device is paired") } @Test func theBadgeIsTheNeedsYouCountAndClearsOnSignOut() async throws { let fake = FakeNotifications() let model = EquipoAppModel(store: MemorySecretStore(), notifications: fake, push: PushRegistrar(environment: nil)) model.needsYouChanged(3) #expect(fake.badges.isEmpty, "no team, no badge") var account = DeviceAccount.new(origin: URL(string: "https://oficina.example.test")!, label: "Test") account.credential = try Fixture.decode("device-credential") model.adopt(account, transport: ScriptedTransport()) model.needsYouChanged(nil) #expect(fake.badges.isEmpty, "an unknown count is not zero") model.needsYouChanged(2) #expect(fake.badges == [2]) model.sessionEnded() #expect(fake.badges == [2, 0]) } @Test func signingOutStopsDeliveryEvenWhenTheServerCannotBeReached() async throws { let fake = FakeNotifications() let model = EquipoAppModel(store: MemorySecretStore(), notifications: fake, push: PushRegistrar(environment: nil)) var account = DeviceAccount.new(origin: URL(string: "https://oficina.example.test")!, label: "Test") account.credential = try Fixture.decode("device-credential") let t = ScriptedTransport() t.on("GET /auth/devices", .failure(.offline)) model.adopt(account, transport: t) await model.signOut() #expect(fake.unregistered == 1, "offline sign-out still stops this device receiving the team's notifications") model.adopt(account, transport: ScriptedTransport()) model.sessionEnded() #expect(fake.unregistered == 2, "a session the server ended stops them too") } @Test func aTapGoesWhereItSays() { let model = EquipoAppModel(store: MemorySecretStore(), notifications: FakeNotifications(), push: PushRegistrar(environment: nil)) model.open(.card("c1")) #expect(model.destination == Destination(pane: .conversation, cardID: "c1")) model.open(.task("tk1")) #expect(model.destination == Destination(pane: .tasks, taskID: "tk1")) } }