1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Foundation
extension MockBlueskyService {
var postTargetFixture: [Post] {
let kind = ProcessInfo.processInfo.environment["OLDFELLA_UI_TEST_POST_KIND"] ?? "short"
let image = URL(string: "data:image/png;base64,\(Self.imageGridPNGData.base64EncodedString())")!
let text: String
switch kind {
case "image": text = ""
case "multiline": text = "First line.\nSecond line.\nLast line."
case "links": text = "Hello @alex.example and https://example.invalid/article."
default: text = "Short post."
}
var post = Post(
id: "at://mae.example/app.bsky.feed.post/tap-target", author: authors[0], text: text,
likeCount: 1, repostCount: 2, isLiked: false, isReposted: false,
imageURLs: kind == "image" ? [image] : [], replyIDs: [],
createdAt: Date(timeIntervalSince1970: 1_714_998_896))
if kind == "links" {
post.facets = [
Self.mockFacet(in: text, matching: "@alex.example", feature: .mention("alex")),
Self.mockFacet(
in: text, matching: "https://example.invalid/article",
feature: .link(URL(string: "https://example.invalid/article")!))
]
post.quote = Post.Quote(postID: "post-2", author: authors[1], text: "The quoted destination.")
}
return [
post,
Post(
id: "post-2", author: authors[1], text: "The quoted destination.",
likeCount: 0, repostCount: 0, isLiked: false, isReposted: false,
imageURLs: [], replyIDs: [])
]
}
}