Skip to content

Commit 92d9263

Browse files
committed
Retain Stop marker creation coverage for every unfinished tool state
1 parent 7908c06 commit 92d9263

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎apps/sim/lib/mothership/chat/persisted-message.test.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ import {
1717
} from './persisted-message'
1818

1919
describe('persisted-message', () => {
20-
it.each(['executing', 'pending', 'awaiting_approval'] as const)(
21-
'cancels unfinished %s tools even when the stopped marker already exists',
22-
(state) => {
20+
it.each([
21+
{ state: 'executing', alreadyStopped: false },
22+
{ state: 'executing', alreadyStopped: true },
23+
{ state: 'pending', alreadyStopped: false },
24+
{ state: 'pending', alreadyStopped: true },
25+
{ state: 'awaiting_approval', alreadyStopped: false },
26+
{ state: 'awaiting_approval', alreadyStopped: true },
27+
] as const)(
28+
'cancels $state tools (existing stopped marker: $alreadyStopped)',
29+
({ state, alreadyStopped }) => {
2330
const message: PersistedMessage = {
2431
id: 'assistant',
2532
role: 'assistant',
@@ -36,7 +43,7 @@ describe('persisted-message', () => {
3643
},
3744
},
3845
{ type: 'tool', toolCall: { id: 'finished', name: 'read', state: 'success' } },
39-
{ type: 'complete', status: 'cancelled' },
46+
...(alreadyStopped ? [{ type: 'complete' as const, status: 'cancelled' as const }] : []),
4047
],
4148
}
4249
const saved = withStoppedContentBlock(message)

0 commit comments

Comments
 (0)