Skip to content

Commit

Permalink
Update to swift-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ptoffy committed Oct 5, 2024
1 parent 57adc35 commit 12d876b
Show file tree
Hide file tree
Showing 9 changed files with 288 additions and 289 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<br>

Support for JWT (JSON Web Tokens) in Vapor.
This package integrates [JWTKit](https://github.com/vapor/jwt-kit.git) with Vapor.

### Installation

Expand Down
7 changes: 7 additions & 0 deletions Tests/JWTTests/Helpers/ByteBuffer+string.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Vapor

extension ByteBuffer {
var string: String {
.init(decoding: self.readableBytesView, as: UTF8.self)
}
}
10 changes: 10 additions & 0 deletions Tests/JWTTests/Helpers/isLoggingConfigured.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Vapor

let isLoggingConfigured: Bool = {
LoggingSystem.bootstrap { label in
var handler = StreamLogHandler.standardOutput(label: label)
handler.logLevel = .debug
return handler
}
return true
}()
10 changes: 10 additions & 0 deletions Tests/JWTTests/Helpers/withApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Testing
import Vapor

func withApp<ReturnType>(_ body: (Application) async throws -> ReturnType) async throws -> ReturnType {
let app = try await Application.make(.testing)
try #require(isLoggingConfigured == true)
let result = try await body(app)
try await app.asyncShutdown()
return result
}
Loading

0 comments on commit 12d876b

Please sign in to comment.