import Foundation import Testing @testable import XToolSupport @Test func ascJSONParsesNestedAppleResponses() throws { let json = try ASCJSON(parsing: Data(#"{"data":[{"id":"app1","attributes":{"bundleId":"com.example.app","rank":2,"beta":true}}]}"#.utf8)) let first = json["data"]?.arrayValue?.first #expect(first?["id"]?.stringValue == "app1") #expect(first?["attributes"]?["bundleId"]?.stringValue == "com.example.app") #expect(first?["attributes"]?["beta"]?.boolValue == true) let roundTrip = try ASCJSON(parsing: json.serialize()) #expect(roundTrip["data"]?.arrayValue?.first?["id"]?.stringValue == "app1") } @Test func ascChecksumsMatchKnownVectors() throws { let file = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) try Data("abc".utf8).write(to: file) defer { try? FileManager.default.removeItem(at: file) } let sums = try AppStoreConnectClient.checksums(of: file) // RFC 1321 / FIPS 180-2 test vectors for "abc". #expect(sums.md5 == "900150983cd24fb0d6963f7d28e17f72") #expect(sums.sha256 == "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad") }