feat: Adds basic tests for database client.
This commit is contained in:
@@ -10,32 +10,29 @@ public struct Employee: Codable, Equatable, Identifiable, Sendable {
|
||||
public var updatedAt: Date
|
||||
|
||||
public init(
|
||||
id: UUID? = nil,
|
||||
id: UUID,
|
||||
active: Bool = true,
|
||||
createdAt: Date? = nil,
|
||||
createdAt: Date,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
updatedAt: Date? = nil
|
||||
updatedAt: Date
|
||||
) {
|
||||
@Dependency(\.date) var date
|
||||
@Dependency(\.uuid) var uuid
|
||||
|
||||
self.id = id ?? uuid()
|
||||
self.id = id
|
||||
self.active = active
|
||||
self.createdAt = createdAt ?? date.now
|
||||
self.createdAt = createdAt
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.updatedAt = updatedAt ?? date.now
|
||||
self.updatedAt = updatedAt
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public extension Employee {
|
||||
static var mocks: [Self] {
|
||||
[
|
||||
.init(firstName: "Michael", lastName: "Housh"),
|
||||
.init(firstName: "Blob", lastName: "Esquire"),
|
||||
.init(firstName: "Testy", lastName: "McTestface")
|
||||
]
|
||||
}
|
||||
}
|
||||
// public extension Employee {
|
||||
// static var mocks: [Self] {
|
||||
// [
|
||||
// .init(firstName: "Michael", lastName: "Housh"),
|
||||
// .init(firstName: "Blob", lastName: "Esquire"),
|
||||
// .init(firstName: "Testy", lastName: "McTestface")
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user