Created
March 16, 2025 13:29
-
-
Save finestructure/0e09fab7da067b29d49299b6454f9782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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