Tests/OrgAppTests/WindowModelTests.swift

3aa264c947476955d58c5cccc70e97072bb47877
orgstar/Tests/OrgAppTests/WindowModelTests.swift

22 lines · 880 bytes

 1import Foundation
 2import OrgDocument
 3import Testing
 4@testable import OrgApp
 5
 6/// `WindowModel` lives in the app target; this is its contract over the session, checked with
 7/// the session alone: a split is a new pane showing the focused buffer; closing a pane leaves
 8/// its buffer open; the last pane stays.
 9@MainActor
10struct WindowModelContractTests {
11    @Test func aSplitShowsTheSameBufferInANewPane() throws {
12        let notes = try Folder()
13        let a = try notes.write("a.org", "* A\n").path
14        let session = DocumentSession(recovery: FileRecoveryStore(directory: notes.url.appendingPathComponent(".r")))
15        session.open(a)
16        let pane = session.makePane()
17        session.open(a, in: pane)
18        #expect(pane.path == a && session.openPaths == [a])
19        session.closePane(pane)
20        #expect(session.panes.count == 1 && session.isOpen(a))
21    }
22}
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