Skip to content

Instantly share code, notes, and snippets.

@finestructure
Created March 16, 2025 13:29
Show Gist options
  • Save finestructure/0e09fab7da067b29d49299b6454f9782 to your computer and use it in GitHub Desktop.
Save finestructure/0e09fab7da067b29d49299b6454f9782 to your computer and use it in GitHub Desktop.
import Testing
struct DatabasePoolSetupTrait: SuiteTrait, TestScoping {
func provideScope(for test: Test, testCase: Test.Case?, performing function: @Sendable () async throws -> Void) async throws {
try await DatabasePool.shared.setUp()
try await function()
try await DatabasePool.shared.tearDown()
}
}
extension SuiteTrait where Self == DatabasePoolSetupTrait {
static var setupDatabasePool: Self {
Self()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment