Skip to content

Commit

Permalink
Try with test serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Oct 20, 2024
1 parent 028df3f commit b319928
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 1 addition & 3 deletions Tests/OrdersTests/OrdersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Zip
struct OrdersTests {
let ordersURI = "/api/orders/v1/"

@Test("Order Generation", arguments: [true, false])
@Test("Order Generation", .serialized, arguments: [true, false])
func orderGeneration(useEncryptedKey: Bool) async throws {
try await withApp(useEncryptedKey: useEncryptedKey) { app, ordersService in
let orderData = OrderData(title: "Test Order")
Expand All @@ -24,13 +24,11 @@ struct OrdersTests {
#expect(FileManager.default.fileExists(atPath: orderFolder.path.appending("/signature")))

#expect(FileManager.default.fileExists(atPath: orderFolder.path.appending("/order.json")))
/* TODO: Fix this test
let passJSONData = try String(contentsOfFile: orderFolder.path.appending("/order.json")).data(using: .utf8)
let passJSON = try JSONSerialization.jsonObject(with: passJSONData!) as! [String: Any]
#expect(passJSON["authenticationToken"] as? String == order.authenticationToken)
let orderID = try order.requireID().uuidString
#expect(passJSON["orderIdentifier"] as? String == orderID)
*/

let manifestJSONData = try String(contentsOfFile: orderFolder.path.appending("/manifest.json")).data(using: .utf8)
let manifestJSON = try JSONSerialization.jsonObject(with: manifestJSONData!) as! [String: Any]
Expand Down
6 changes: 1 addition & 5 deletions Tests/PassesTests/PassesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Zip
struct PassesTests {
let passesURI = "/api/passes/v1/"

@Test("Pass Generation", arguments: [true, false])
@Test("Pass Generation", .serialized, arguments: [true, false])
func passGeneration(useEncryptedKey: Bool) async throws {
try await withApp(useEncryptedKey: useEncryptedKey) { app, passesService in
let passData = PassData(title: "Test Pass")
Expand All @@ -24,14 +24,12 @@ struct PassesTests {
#expect(FileManager.default.fileExists(atPath: passFolder.path.appending("/signature")))

#expect(FileManager.default.fileExists(atPath: passFolder.path.appending("/pass.json")))
/* TODO: Fix this test
let passJSONData = try String(contentsOfFile: passFolder.path.appending("/pass.json")).data(using: .utf8)
let passJSON = try JSONSerialization.jsonObject(with: passJSONData!) as! [String: Any]
#expect(passJSON["authenticationToken"] as? String == pass.authenticationToken)
let passID = try pass.requireID().uuidString
#expect(passJSON["serialNumber"] as? String == passID)
#expect(passJSON["description"] as? String == passData.title)
*/

let manifestJSONData = try String(contentsOfFile: passFolder.path.appending("/manifest.json")).data(using: .utf8)
let manifestJSON = try JSONSerialization.jsonObject(with: manifestJSONData!) as! [String: Any]
Expand Down Expand Up @@ -80,14 +78,12 @@ struct PassesTests {
#expect(FileManager.default.fileExists(atPath: passFolder.path.appending("/signature")))

#expect(FileManager.default.fileExists(atPath: passFolder.path.appending("/pass.json")))
/* TODO: Fix this test
let passJSONData = try String(contentsOfFile: passFolder.path.appending("/pass.json")).data(using: .utf8)
let passJSON = try JSONSerialization.jsonObject(with: passJSONData!) as! [String: Any]
#expect(passJSON["authenticationToken"] as? String == pass.authenticationToken)
let passID = try pass.requireID().uuidString
#expect(passJSON["serialNumber"] as? String == passID)
#expect(passJSON["description"] as? String == passData.title)
*/

let personalizationJSONData = try String(contentsOfFile: passFolder.path.appending("/personalization.json")).data(using: .utf8)
let personalizationJSON = try JSONSerialization.jsonObject(with: personalizationJSONData!) as! [String: Any]
Expand Down

0 comments on commit b319928

Please sign in to comment.