From ee3000c9d8ce4e3cf1ac65ce6007c191f3165080 Mon Sep 17 00:00:00 2001 From: Francesco Paolo Severino Date: Sat, 12 Oct 2024 11:31:46 +0200 Subject: [PATCH] Add labels to tests and suites --- Tests/OrdersTests/EncryptedOrdersTests.swift | 7 +++-- Tests/OrdersTests/OrdersTests.swift | 23 ++++++++++------ Tests/PassesTests/EncryptedPassesTests.swift | 10 +++++-- Tests/PassesTests/PassesTests.swift | 29 +++++++++++++------- 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/Tests/OrdersTests/EncryptedOrdersTests.swift b/Tests/OrdersTests/EncryptedOrdersTests.swift index 5ddf2cc..78e6334 100644 --- a/Tests/OrdersTests/EncryptedOrdersTests.swift +++ b/Tests/OrdersTests/EncryptedOrdersTests.swift @@ -6,11 +6,13 @@ import Zip @testable import Orders +@Suite("Orders Tests with encrypted PEM key") struct EncryptedOrdersTests { let delegate = EncryptedOrdersDelegate() let ordersURI = "/api/orders/v1/" - @Test func orderGeneration() async throws { + @Test("Test order generation") + func orderGeneration() async throws { try await withApp(delegate: delegate) { app, ordersService in let orderData = OrderData(title: "Test Order") try await orderData.create(on: app.db) @@ -36,7 +38,8 @@ struct EncryptedOrdersTests { } } - @Test func apnsClient() async throws { + @Test("Test APNS client") + func apnsClient() async throws { try await withApp(delegate: delegate) { app, ordersService in #expect(app.apns.client(.init(string: "orders")) != nil) diff --git a/Tests/OrdersTests/OrdersTests.swift b/Tests/OrdersTests/OrdersTests.swift index c03ab97..84d5edf 100644 --- a/Tests/OrdersTests/OrdersTests.swift +++ b/Tests/OrdersTests/OrdersTests.swift @@ -6,11 +6,13 @@ import Zip @testable import Orders +@Suite("Orders Tests") struct OrdersTests { let delegate = TestOrdersDelegate() let ordersURI = "/api/orders/v1/" - @Test func orderGeneration() async throws { + @Test("Test order generation") + func orderGeneration() async throws { try await withApp(delegate: delegate) { app, ordersService in let orderData = OrderData(title: "Test Order") try await orderData.create(on: app.db) @@ -37,8 +39,8 @@ struct OrdersTests { } } - // Tests the API Apple Wallet calls to get orders - @Test func getOrderFromAPI() async throws { + @Test("Getting order from Apple Wallet API") + func getOrderFromAPI() async throws { try await withApp(delegate: delegate) { app, ordersService in let orderData = OrderData(title: "Test Order") try await orderData.create(on: app.db) @@ -113,7 +115,8 @@ struct OrdersTests { } } - @Test func apiDeviceRegistration() async throws { + @Test("Test device registration API") + func apiDeviceRegistration() async throws { try await withApp(delegate: delegate) { app, ordersService in let orderData = OrderData(title: "Test Order") try await orderData.create(on: app.db) @@ -265,7 +268,8 @@ struct OrdersTests { } } - @Test func errorLog() async throws { + @Test("Test error logging") + func errorLog() async throws { try await withApp(delegate: delegate) { app, ordersService in let log1 = "Error 1" let log2 = "Error 2" @@ -309,7 +313,8 @@ struct OrdersTests { } } - @Test func apnsClient() async throws { + @Test("Test APNS client") + func apnsClient() async throws { try await withApp(delegate: delegate) { app, ordersService in #expect(app.apns.client(.init(string: "orders")) != nil) @@ -382,14 +387,16 @@ struct OrdersTests { } } - @Test func ordersError() { + @Test("Test OrdersError") + func ordersError() { #expect(OrdersError.templateNotDirectory.description == "OrdersError(errorType: templateNotDirectory)") #expect(OrdersError.pemCertificateMissing.description == "OrdersError(errorType: pemCertificateMissing)") #expect(OrdersError.pemPrivateKeyMissing.description == "OrdersError(errorType: pemPrivateKeyMissing)") #expect(OrdersError.opensslBinaryMissing.description == "OrdersError(errorType: opensslBinaryMissing)") } - @Test func defaultDelegate() { + @Test("Test default OrdersDelegate properties") + func defaultDelegate() { let delegate = DefaultOrdersDelegate() #expect(delegate.wwdrCertificate == "WWDR.pem") #expect(delegate.pemCertificate == "ordercertificate.pem") diff --git a/Tests/PassesTests/EncryptedPassesTests.swift b/Tests/PassesTests/EncryptedPassesTests.swift index af17d4f..5596d03 100644 --- a/Tests/PassesTests/EncryptedPassesTests.swift +++ b/Tests/PassesTests/EncryptedPassesTests.swift @@ -5,11 +5,13 @@ import Zip @testable import Passes +@Suite("Passes Tests with encrypted PEM key") struct EncryptedPassesTests { let delegate = EncryptedPassesDelegate() let passesURI = "/api/passes/v1/" - @Test func passGeneration() async throws { + @Test("Test pass generation") + func passGeneration() async throws { try await withApp(delegate: delegate) { app, passesService in let passData = PassData(title: "Test Pass") try await passData.create(on: app.db) @@ -36,7 +38,8 @@ struct EncryptedPassesTests { } } - @Test func personalizationAPI() async throws { + @Test("Personalizable pass Apple Wallet API") + func personalizationAPI() async throws { try await withApp(delegate: delegate) { app, passesService in let passData = PassData(title: "Personalize") try await passData.create(on: app.db) @@ -82,7 +85,8 @@ struct EncryptedPassesTests { } } - @Test func apnsClient() async throws { + @Test("Test APNS client") + func apnsClient() async throws { try await withApp(delegate: delegate) { app, passesService in #expect(app.apns.client(.init(string: "passes")) != nil) diff --git a/Tests/PassesTests/PassesTests.swift b/Tests/PassesTests/PassesTests.swift index 466be02..a5c8451 100644 --- a/Tests/PassesTests/PassesTests.swift +++ b/Tests/PassesTests/PassesTests.swift @@ -6,11 +6,13 @@ import Zip @testable import Passes +@Suite("Passes Tests") struct PassesTests { let delegate = TestPassesDelegate() let passesURI = "/api/passes/v1/" - @Test func passGeneration() async throws { + @Test("Test pass generation") + func passGeneration() async throws { try await withApp(delegate: delegate) { app, passesService in let passData = PassData(title: "Test Pass") try await passData.create(on: app.db) @@ -62,7 +64,8 @@ struct PassesTests { } } - @Test func personalization() async throws { + @Test("Test personalizable pass") + func personalization() async throws { try await withApp(delegate: delegate) { app, passesService in let passData = PassData(title: "Personalize") try await passData.create(on: app.db) @@ -91,8 +94,8 @@ struct PassesTests { } } - // Tests the API Apple Wallet calls to get passes - @Test func getPassFromAPI() async throws { + @Test("Getting pass from Apple Wallet API") + func getPassFromAPI() async throws { try await withApp(delegate: delegate) { app, passesService in let passData = PassData(title: "Test Pass") try await passData.create(on: app.db) @@ -167,7 +170,8 @@ struct PassesTests { } } - @Test func personalizationAPI() async throws { + @Test("Personalizable pass Apple Wallet API") + func personalizationAPI() async throws { try await withApp(delegate: delegate) { app, passesService in let passData = PassData(title: "Personalize") try await passData.create(on: app.db) @@ -236,7 +240,8 @@ struct PassesTests { } } - @Test func apiDeviceRegistration() async throws { + @Test("Test device registration API") + func apiDeviceRegistration() async throws { try await withApp(delegate: delegate) { app, passesService in let passData = PassData(title: "Test Pass") try await passData.create(on: app.db) @@ -388,7 +393,8 @@ struct PassesTests { } } - @Test func errorLog() async throws { + @Test("Test error logging") + func errorLog() async throws { try await withApp(delegate: delegate) { app, passesService in let log1 = "Error 1" let log2 = "Error 2" @@ -432,7 +438,8 @@ struct PassesTests { } } - @Test func apnsClient() async throws { + @Test("Test APNS client") + func apnsClient() async throws { try await withApp(delegate: delegate) { app, passesService in #expect(app.apns.client(.init(string: "passes")) != nil) @@ -505,7 +512,8 @@ struct PassesTests { } } - @Test func passesError() { + @Test("Test PassesError") + func passesError() { #expect(PassesError.templateNotDirectory.description == "PassesError(errorType: templateNotDirectory)") #expect(PassesError.pemCertificateMissing.description == "PassesError(errorType: pemCertificateMissing)") #expect(PassesError.pemPrivateKeyMissing.description == "PassesError(errorType: pemPrivateKeyMissing)") @@ -513,7 +521,8 @@ struct PassesTests { #expect(PassesError.invalidNumberOfPasses.description == "PassesError(errorType: invalidNumberOfPasses)") } - @Test func defaultDelegate() async throws { + @Test("Test default PassesDelegate properties") + func defaultDelegate() async throws { let defaultDelegate = DefaultPassesDelegate() #expect(defaultDelegate.wwdrCertificate == "WWDR.pem") #expect(defaultDelegate.pemCertificate == "passcertificate.pem")