~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/old-fella

Old people's social media app

0
1
main
36 lines · 1.6 KB Raw History
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: [])
        ]
    }
}