@@ -46,7 +46,36 @@ func testMenuRowsBuilder() throws {
4646 )
4747 try expect (
4848 rows [ headerIndex - 1 ] == . separator,
49- " spending sections should be separated from the bottom app section "
49+ " refresh rows should be separated from the app controls section "
50+ )
51+ let lastRefreshedIndex = rows. firstIndex { row in
52+ if case . disabled( let label) = row {
53+ return label. hasPrefix ( " Last refreshed: " )
54+ }
55+ return false
56+ }
57+ guard let lastRefreshedIndex else {
58+ throw TestFailure ( description: " menu should include a last refreshed row " )
59+ }
60+ try expect (
61+ rows [ lastRefreshedIndex - 1 ] == . separator,
62+ " spending sections should be separated from refresh rows "
63+ )
64+ if case . disabled( let label) = rows [ lastRefreshedIndex] {
65+ try expect (
66+ label. hasPrefix ( " Last refreshed: " ) , " last refreshed should lead the refresh section " )
67+ } else {
68+ throw TestFailure (
69+ description: " first row in the refresh section should be 'Last refreshed:' " )
70+ }
71+ try expect (
72+ rows [ lastRefreshedIndex + 1 ]
73+ == . action( title: " Refresh " , kind: . refresh, keyEquivalent: " " , state: . off) ,
74+ " refresh action should appear below the last refreshed row "
75+ )
76+ try expect (
77+ rows [ lastRefreshedIndex + 2 ] == . separator,
78+ " refresh rows should be separated from app controls "
5079 )
5180 try expect (
5281 rows [ headerIndex + 1 ]
@@ -56,15 +85,8 @@ func testMenuRowsBuilder() throws {
5685 keyEquivalent: " " ,
5786 state: . off
5887 ) ,
59- " first row in the bottom app section should be update action "
88+ " update action should appear directly below the version row "
6089 )
61- if case . disabled( let label) = rows [ headerIndex + 2 ] {
62- try expect (
63- label. hasPrefix ( " Last refreshed: " ) , " last refreshed should appear below the update action " )
64- } else {
65- throw TestFailure (
66- description: " row after update action should be 'Last refreshed:' disabled item " )
67- }
6890 try expect (
6991 rows. contains ( . disabled( " Today: $49 " ) ) ,
7092 " today cost should round up to the next display dollar "
@@ -144,15 +166,15 @@ func testMenuRowsBuilder() throws {
144166 appVersion: " 0.7 " ,
145167 now: now
146168 )
169+ let updateAvailableHeaderIndex = updateAvailableRows. firstIndex ( of: . disabled( " AgentTally v0.7 " ) ) !
147170 try expect (
148- updateAvailableRows. prefix ( 2 ) . contains (
149- . action(
171+ updateAvailableRows [ updateAvailableHeaderIndex + 1 ]
172+ == . action(
150173 title: " Update Available: v0.8... " ,
151174 kind: . checkForUpdates,
152175 keyEquivalent: " " ,
153176 state: . off
154- )
155- ) ,
177+ ) ,
156178 " available updates should be visible directly below the header "
157179 )
158180 try expect (
0 commit comments