fix(web): update diff-card tests for the openFile no-double-resolve contract

The coverage lane caught a regression in the prior commit: FileMutationRow now
passes the tool's raw path to the injected openFile (which resolves against cwd
in apply.ts), but diff-card.spec still asserted the row pre-resolved. Assert on
the raw path instead. Also fix the built-boot diff assertion to match on the
line body and footer text — the `+ ` prefix is a CSS ::before, absent from
textContent.
This commit is contained in:
Chinesezjc
2026-07-30 21:51:27 +08:00
parent 46e18cf0d3
commit 568c564db4
2 changed files with 9 additions and 7 deletions

View File

@@ -163,11 +163,13 @@ describe('FileMutationRow diff card', () => {
expect(view.getByText('复制')).toBeTruthy()
})
it('the summary is a path link that opens through the host, cwd-resolved', () => {
it('the summary is a path link that opens the tool path through the host', () => {
const openFile = vi.fn()
const view = render(<FileMutationRow {...{ ...rowProps(settled()), openFile }} />)
fireEvent.click(view.getByRole('button', { name: 'notes/demo.txt' }))
expect(openFile).toHaveBeenCalledWith('/w/app/notes/demo.txt')
// The row passes the tool's own path; the injected openFile resolves it
// against the session cwd (apply.ts), so the row must not resolve twice.
expect(openFile).toHaveBeenCalledWith('notes/demo.txt')
})
it('registers under write too, rendering a create as an added-only diff', () => {