Fix mock content build

This commit is contained in:
Christoph Hagen
2025-04-06 13:29:24 +02:00
parent 80e90c4055
commit 01c49433cd
10 changed files with 42 additions and 26 deletions

View File

@ -0,0 +1,40 @@
import Foundation
extension Page {
enum Mock {
static func mockData(content: Content) -> [Page] {
[
Page(
content: content,
id: "my-id",
externalLink: nil,
isDraft: true,
createdDate: Date(),
hideDate: false,
startDate: Date().addingTimeInterval(-86400),
endDate: nil,
german: LocalizedPage(
content: content,
urlString: "mein-projekt",
title: "Mein Erstes Projekt",
lastModified: nil,
originalUrl: "projects/electronics/my-first-project/de.html"),
english: LocalizedPage(
content: content,
urlString: "my-project",
title: "My First Project",
lastModified: nil,
originalUrl: "projects/electronics/my-first-project/en.html"),
tags: [
content.tags.first(where: { $0.id == "electronics" })!
])
]
}
static var empty: Page {
Content.mock.pages.first(where: { $0.id == "my-id" })!
}
}
}