Spaces:
Paused
Paused
Download apps/ios/Tests/DeepLinkParserTests.swift from nikhtu10/OpenClawBot: direct link, hf CLI and curl.
- Browser
- Download file 2.61 kB
-
https://huggingface.co/spaces/nikhtu10/OpenClawBot/resolve/main/apps/ios/Tests/DeepLinkParserTests.swift
- Command line
-
hf download hf://spaces/nikhtu10/OpenClawBot/apps/ios/Tests/DeepLinkParserTests.swift
-
curl -L -o DeepLinkParserTests.swift https://huggingface.co/spaces/nikhtu10/OpenClawBot/resolve/main/apps/ios/Tests/DeepLinkParserTests.swift
2.61 kB
| import OpenClawKit | |
| import Foundation | |
| import Testing | |
| struct DeepLinkParserTests { | |
| func parseRejectsUnknownHost() { | |
| let url = URL(string: "openclaw://nope?message=hi")! | |
| #expect(DeepLinkParser.parse(url) == nil) | |
| } | |
| func parseHostIsCaseInsensitive() { | |
| let url = URL(string: "openclaw://AGENT?message=Hello")! | |
| #expect(DeepLinkParser.parse(url) == .agent(.init( | |
| message: "Hello", | |
| sessionKey: nil, | |
| thinking: nil, | |
| deliver: false, | |
| to: nil, | |
| channel: nil, | |
| timeoutSeconds: nil, | |
| key: nil))) | |
| } | |
| func parseRejectsNonOpenClawScheme() { | |
| let url = URL(string: "https://example.com/agent?message=hi")! | |
| #expect(DeepLinkParser.parse(url) == nil) | |
| } | |
| func parseRejectsEmptyMessage() { | |
| let url = URL(string: "openclaw://agent?message=%20%20%0A")! | |
| #expect(DeepLinkParser.parse(url) == nil) | |
| } | |
| func parseAgentLinkParsesCommonFields() { | |
| let url = | |
| URL(string: "openclaw://agent?message=Hello&deliver=1&sessionKey=node-test&thinking=low&timeoutSeconds=30")! | |
| #expect( | |
| DeepLinkParser.parse(url) == .agent( | |
| .init( | |
| message: "Hello", | |
| sessionKey: "node-test", | |
| thinking: "low", | |
| deliver: true, | |
| to: nil, | |
| channel: nil, | |
| timeoutSeconds: 30, | |
| key: nil))) | |
| } | |
| func parseAgentLinkParsesTargetRoutingFields() { | |
| let url = | |
| URL( | |
| string: "openclaw://agent?message=Hello%20World&deliver=1&to=%2B15551234567&channel=whatsapp&key=secret")! | |
| #expect( | |
| DeepLinkParser.parse(url) == .agent( | |
| .init( | |
| message: "Hello World", | |
| sessionKey: nil, | |
| thinking: nil, | |
| deliver: true, | |
| to: "+15551234567", | |
| channel: "whatsapp", | |
| timeoutSeconds: nil, | |
| key: "secret"))) | |
| } | |
| func parseRejectsNegativeTimeoutSeconds() { | |
| let url = URL(string: "openclaw://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))) | |
| } | |
| } | |