Tests/OrgEditorAppKitTests/AppStoreCommandsTests.swift

035009dce58286b0a61a010a3003e59ab3515cc9
orgstar/Tests/OrgEditorAppKitTests/AppStoreCommandsTests.swift

40 lines · 1668 bytes

 1import Foundation
 2import OrgEditorAppKit
 3import Testing
 4import OrgApp
 5
 6struct AppStoreCommandsTests {
 7    @Test func hiddenCommandsExist() {
 8        let ids = Set(EditorCommands.all.map(\.id))
 9        #expect(AppStoreCommands.hidden.isSubset(of: ids))
10    }
11
12    /// LaTeX export is native, so the sandboxed build has it.
13    @Test func latexExportIsShown() {
14        #expect(!AppStoreCommands.hidden.contains("app.export.latex"))
15        #expect(EditorCommands.all.first { $0.id == "app.export.latex" }?.title == "Export to LaTeX")
16    }
17
18    /// ASCII export is native, so the sandboxed build has it.
19    @Test func asciiExportIsShown() {
20        #expect(!AppStoreCommands.hidden.contains("app.export.text"))
21        #expect(EditorCommands.all.first { $0.id == "app.export.text" }?.title == "Export to Plain Text (ASCII)")
22    }
23
24    @Test func pdfKeysExportThroughWebKit() throws {
25        let replacement = try #require(AppStoreCommands.replacement(for: "app.export.pdf"))
26        #expect(replacement == "app.export.print-pdf")
27        #expect(!AppStoreCommands.hidden.contains(replacement))
28        for id in AppStoreCommands.hidden where id != "app.export.pdf" {
29            #expect(AppStoreCommands.replacement(for: id) == nil)
30        }
31    }
32
33    /// Linking a file from another container fails in the sandbox, so iOS refuses these too.
34    @Test func attachingByLinkIsUnavailable() {
35        #expect(AppStoreCommands.unavailable("app.attach.link"))
36        #expect(AppStoreCommands.unavailable("app.attach.symlink"))
37        #expect(!AppStoreCommands.unavailable("app.attach.attach"))
38        #expect(!AppStoreCommands.unavailable("app.export.pdf"))
39    }
40}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form