Skip to content

Commit 4fef9c4

Browse files
committed
test(tables): assert which downstream groups a resume's cascade started
1 parent 70755c3 commit 4fef9c4

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎apps/sim/background/resume-governed-subject.test.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ describe('resuming a paused table cell', () => {
220220
}, 20_000)
221221

222222
describe('when the resume throws', () => {
223+
/** Downstream groups the row's cascade started after the resume. */
224+
let startedGroups: string[]
225+
226+
beforeEach(() => {
227+
startedGroups = []
228+
mocks.runRowCascadeLoop.mockImplementation(async (payload: { groupId: string }) => {
229+
startedGroups.push(payload.groupId)
230+
})
231+
})
232+
223233
/** The execution state the last cell write persisted. */
224234
function lastCellExecutionState() {
225235
const [, payload] = mocks.writeWorkflowGroupState.mock.calls.at(-1) ?? []
@@ -267,7 +277,7 @@ describe('resuming a paused table cell', () => {
267277
executionId: 'parent-execution-1',
268278
error: null,
269279
})
270-
expect(mocks.runRowCascadeLoop).toHaveBeenCalledTimes(1)
280+
expect(startedGroups).toEqual([NEXT_GROUP.id])
271281
}, 20_000)
272282

273283
it('does not continue the cascade when the completed cell could not be saved', async () => {
@@ -277,7 +287,7 @@ describe('resuming a paused table cell', () => {
277287

278288
await expect(executeResumeJob(PAYLOAD)).rejects.toBe(bookkeepingFailure)
279289

280-
expect(mocks.runRowCascadeLoop).not.toHaveBeenCalled()
290+
expect(startedGroups).toEqual([])
281291
}, 20_000)
282292

283293
it('does not continue the cascade when the resume failed the execution', async () => {
@@ -286,7 +296,7 @@ describe('resuming a paused table cell', () => {
286296

287297
await expect(executeResumeJob(PAYLOAD)).rejects.toBe(runFailure)
288298

289-
expect(mocks.runRowCascadeLoop).not.toHaveBeenCalled()
299+
expect(startedGroups).toEqual([])
290300
}, 20_000)
291301

292302
it('puts the cell back to paused when the pause stayed resumable', async () => {

0 commit comments

Comments
 (0)