diff --git a/Sources/XKit/Model/Entitlements/EntitlementTypes.swift b/Sources/XKit/Model/Entitlements/EntitlementTypes.swift index 1d65a047..26224859 100644 --- a/Sources/XKit/Model/Entitlements/EntitlementTypes.swift +++ b/Sources/XKit/Model/Entitlements/EntitlementTypes.swift @@ -17,7 +17,7 @@ extension EntitlementContainer { TeamIdentifierEntitlement.self, KeychainAccessGroupsEntitlement.self, GetTaskAllowEntitlement.self, -// AssociatedDomainsEntitlement.self, + AssociatedDomainsEntitlement.self, APSEnvironmentEntitlement.self, AppGroupEntitlement.self, // NetworkExtensionEntitlement.self, diff --git a/Tests/XToolTests/AssociatedDomainsEntitlementTests.swift b/Tests/XToolTests/AssociatedDomainsEntitlementTests.swift new file mode 100644 index 00000000..af6a8cfa --- /dev/null +++ b/Tests/XToolTests/AssociatedDomainsEntitlementTests.swift @@ -0,0 +1,37 @@ +import Foundation +import Testing +@testable import XKit + +@Test func associatedDomainsEntitlementMapsToDeveloperCapability() throws { + let plist = """ + + + + + com.apple.developer.associated-domains + + applinks:example.com + + + + """ + + let entitlements = try PropertyListDecoder().decode( + Entitlements.self, + from: Data(plist.utf8) + ) + let associatedDomains = try #require( + entitlements.entitlements().compactMap { $0 as? AssociatedDomainsEntitlement }.first + ) + + #expect(associatedDomains.rawValue == ["applinks:example.com"]) + #expect(associatedDomains.capability.capabilityType.value1 == .associatedDomains) + #expect(!associatedDomains.capability.isFree) + + let encoded = try PropertyListEncoder().encode(entitlements) + let dictionary = try #require( + PropertyListSerialization.propertyList(from: encoded, format: nil) as? [String: Any] + ) + + #expect(dictionary[AssociatedDomainsEntitlement.identifier] as? [String] == ["applinks:example.com"]) +}