Skip to content

Commit

Permalink
Add labels to tests and suites
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Oct 12, 2024
1 parent f33856c commit ee3000c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 23 deletions.
7 changes: 5 additions & 2 deletions Tests/OrdersTests/EncryptedOrdersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
23 changes: 15 additions & 8 deletions Tests/OrdersTests/OrdersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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")
Expand Down
10 changes: 7 additions & 3 deletions Tests/PassesTests/EncryptedPassesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
29 changes: 19 additions & 10 deletions Tests/PassesTests/PassesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -505,15 +512,17 @@ 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)")
#expect(PassesError.opensslBinaryMissing.description == "PassesError(errorType: opensslBinaryMissing)")
#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")
Expand Down

0 comments on commit ee3000c

Please sign in to comment.