From 20abf3109391f842a32107086fe34b01591b4503 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 14 Dec 2025 02:17:44 +0000 Subject: [PATCH] test(ios): share scheme and add deep link tests --- apps/ios/Tests/DeepLinkParserTests.swift | 43 ++++++++++++++++++++++++ apps/ios/project.yml | 10 ++++++ 2 files changed, 53 insertions(+) create mode 100644 apps/ios/Tests/DeepLinkParserTests.swift diff --git a/apps/ios/Tests/DeepLinkParserTests.swift b/apps/ios/Tests/DeepLinkParserTests.swift new file mode 100644 index 000000000..35615d56a --- /dev/null +++ b/apps/ios/Tests/DeepLinkParserTests.swift @@ -0,0 +1,43 @@ +import ClawdisKit +import Foundation +import Testing + +@Suite struct DeepLinkParserTests { + @Test func parseRejectsNonClawdisScheme() { + let url = URL(string: "https://example.com/agent?message=hi")! + #expect(DeepLinkParser.parse(url) == nil) + } + + @Test func parseRejectsEmptyMessage() { + let url = URL(string: "clawdis://agent?message=%20%20%0A")! + #expect(DeepLinkParser.parse(url) == nil) + } + + @Test func parseAgentLinkParsesCommonFields() { + let url = URL(string: "clawdis://agent?message=Hello&deliver=1&sessionKey=node-iris&thinking=low&timeoutSeconds=30")! + #expect( + DeepLinkParser.parse(url) == .agent( + .init( + message: "Hello", + sessionKey: "node-iris", + thinking: "low", + deliver: true, + to: nil, + channel: nil, + timeoutSeconds: 30, + key: nil))) + } + + @Test func parseRejectsNegativeTimeoutSeconds() { + let url = URL(string: "clawdis://agent?message=Hello&timeoutSeconds=-1")! + #expect(DeepLinkParser.parse(url) == .agent(.init( + message: "Hello", + sessionKey: nil, + thinking: nil, + deliver: false, + to: nil, + channel: nil, + timeoutSeconds: nil, + key: nil))) + } +} diff --git a/apps/ios/project.yml b/apps/ios/project.yml index 2da19ab13..1c4dc1c58 100644 --- a/apps/ios/project.yml +++ b/apps/ios/project.yml @@ -9,6 +9,16 @@ packages: ClawdisKit: path: ../shared/ClawdisKit +schemes: + Clawdis: + shared: true + build: + targets: + Clawdis: all + test: + targets: + - ClawdisTests + targets: Clawdis: type: application