import Foundation import OrgEditorAppKit import Testing import OrgApp struct AppStoreCommandsTests { @Test func hiddenCommandsExist() { let ids = Set(EditorCommands.all.map(\.id)) #expect(AppStoreCommands.hidden.isSubset(of: ids)) } /// LaTeX export is native, so the sandboxed build has it. @Test func latexExportIsShown() { #expect(!AppStoreCommands.hidden.contains("app.export.latex")) #expect(EditorCommands.all.first { $0.id == "app.export.latex" }?.title == "Export to LaTeX") } /// ASCII export is native, so the sandboxed build has it. @Test func asciiExportIsShown() { #expect(!AppStoreCommands.hidden.contains("app.export.text")) #expect(EditorCommands.all.first { $0.id == "app.export.text" }?.title == "Export to Plain Text (ASCII)") } @Test func pdfKeysExportThroughWebKit() throws { let replacement = try #require(AppStoreCommands.replacement(for: "app.export.pdf")) #expect(replacement == "app.export.print-pdf") #expect(!AppStoreCommands.hidden.contains(replacement)) for id in AppStoreCommands.hidden where id != "app.export.pdf" { #expect(AppStoreCommands.replacement(for: id) == nil) } } /// Linking a file from another container fails in the sandbox, so iOS refuses these too. @Test func attachingByLinkIsUnavailable() { #expect(AppStoreCommands.unavailable("app.attach.link")) #expect(AppStoreCommands.unavailable("app.attach.symlink")) #expect(!AppStoreCommands.unavailable("app.attach.attach")) #expect(!AppStoreCommands.unavailable("app.export.pdf")) } }