Tests/OrgEditorAppKitTests/AppStoreCommandsTests.swift
26 lines · 961 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 @Test func pdfKeysExportThroughWebKit() throws {
19 let replacement = try #require(AppStoreCommands.replacement(for: "app.export.pdf"))
20 #expect(replacement == "app.export.print-pdf")
21 #expect(!AppStoreCommands.hidden.contains(replacement))
22 for id in AppStoreCommands.hidden where id != "app.export.pdf" {
23 #expect(AppStoreCommands.replacement(for: id) == nil)
24 }
25 }
26}