Skip to content

Commit 23a906a

Browse files
committed
diff: a resumed session the diff lists nothing for leaves the opening to the next edit, under test
1 parent e637fb3 commit 23a906a

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

‎mods/diff/tests/register.test.ts‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,50 @@ describe('register', () => {
12171217
).toEqual(['diff'])
12181218
})
12191219

1220+
test('a resumed session whose edits the diff no longer lists opens nothing, the next edit it lists does', async ($, on) => {
1221+
const script: Record<string, string> = {
1222+
...Fixtures.REPOSITORY,
1223+
'HEAD --shortstat': '',
1224+
'HEAD --numstat': '',
1225+
}
1226+
1227+
const world = Fixtures.inRepository(on, script, {
1228+
messages: () => Fixtures.EDITED_TRANSCRIPT,
1229+
})
1230+
1231+
on('tool.call', () => ({ result: 'edited' }))
1232+
1233+
await $.session.start(Fixtures.SESSION)
1234+
await $.ui.render(Fixtures.HINT)
1235+
await world.clock.advance(Fixtures.SETTLE_MS)
1236+
1237+
expect(
1238+
world.opened,
1239+
'committed since: it would say "No changes this session"',
1240+
).toEqual([])
1241+
1242+
Object.assign(script, Fixtures.REPOSITORY)
1243+
1244+
await $.tool.call({
1245+
tool: 'Edit',
1246+
file_path: '/work/app.ts',
1247+
old_string: '1',
1248+
new_string: '2',
1249+
})
1250+
1251+
await world.clock.advance(Fixtures.SETTLE_MS)
1252+
1253+
expect(
1254+
world.opened.map(pane => pane.id),
1255+
'the restore left the opening to the first edit with a row to list',
1256+
).toEqual(['diff'])
1257+
1258+
expect(
1259+
Fixtures.textOf(await $.ui.render(Fixtures.PANE)),
1260+
'listed as it opened',
1261+
).toContain('1 file changed')
1262+
})
1263+
12201264
test('a resumed session opens nothing where its first edit would not', async ($, on) => {
12211265
const narrow = Fixtures.inRepository(on, Fixtures.REPOSITORY, {
12221266
messages: () => Fixtures.EDITED_TRANSCRIPT,

0 commit comments

Comments
 (0)