import Foundation import NorgKit import Testing @testable import NorgUI @Suite struct NorgLinkURLTests { @Test func roundTripsLink() throws { let link = InlineLink(kind: .link, target: "* My Heading") let url = try #require(NorgLinkURL.encode(link)) #expect(NorgLinkURL.decode(url) == link) } @Test func roundTripsAnchor() throws { let link = InlineLink(kind: .anchor, target: "some anchor") let url = try #require(NorgLinkURL.encode(link)) #expect(NorgLinkURL.decode(url) == link) } @Test func roundTripsMissingTarget() throws { let link = InlineLink(kind: .link, target: nil) let url = try #require(NorgLinkURL.encode(link)) #expect(NorgLinkURL.decode(url) == link) } @Test func ignoresForeignURLs() throws { let url = try #require(URL(string: "https://example.com")) #expect(NorgLinkURL.decode(url) == nil) } }