Added the catalogue models and seed to support phase 2 of the POC prototype in the Persistence package.
This commit is contained in:
1 parent
ea89ea892a
commit
09c7b8a1a7
10 files changed
+238
-21
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import Testing
|
||||
|
||||
@testable import Persistence
|
||||
|
||||
@Suite(
|
||||
"AccountRepository repository",
|
||||
.tags(.repository)
|
||||
)
|
||||
struct AccountRepositoryTests {
|
||||
|
||||
// MARK: Methods tests
|
||||
|
||||
@Test
|
||||
func `finds the seeded demo buyer`() async throws {
|
||||
try await withDatabase { fluent in
|
||||
let user = try await AccountRepository(fluent: fluent).account(email: AccountRepository.demoEmail)
|
||||
|
||||
#expect(user.email == "mara.v@example.com")
|
||||
#expect(user.displayName == "Mara Visser")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func `joins an unknown email once, named after its local part`() async throws {
|
||||
try await withDatabase { fluent in
|
||||
let repository = AccountRepository(fluent: fluent)
|
||||
let joined = try await repository.account(email: "sam@example.com")
|
||||
let returning = try await repository.account(email: "sam@example.com")
|
||||
|
||||
#expect(joined.displayName == "sam")
|
||||
#expect(returning == joined)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user