Skip to content

Commit 4363151

Browse files
committed
fix unittest
1 parent cd27ac4 commit 4363151

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

packages/durabletask-js/test/entity-operation-events.spec.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ describe("OrchestrationExecutor Entity Operation Events", () => {
110110

111111
// Assert
112112
expect(callResult).toBe(42);
113-
expect(actions2.length).toBe(1);
114-
expect(actions2[0].hasCompleteorchestration()).toBe(true);
113+
// Note: actions include previously-scheduled entity call (idempotent, has sequence number)
114+
const completeAction = actions2.find((a) => a.hasCompleteorchestration());
115+
expect(completeAction).toBeDefined();
115116
});
116117

117118
it("should handle null result", async () => {
@@ -261,9 +262,10 @@ describe("OrchestrationExecutor Entity Operation Events", () => {
261262
const actions2 = await executor.execute("test-instance", oldEvents2, newEvents2);
262263

263264
// Assert - orchestration should fail
264-
expect(actions2.length).toBe(1);
265-
expect(actions2[0].hasCompleteorchestration()).toBe(true);
266-
const completeAction = actions2[0].getCompleteorchestration()!;
265+
// Note: actions include previously-scheduled entity call (idempotent, has sequence number)
266+
const completeActionWrapper = actions2.find((a) => a.hasCompleteorchestration());
267+
expect(completeActionWrapper).toBeDefined();
268+
const completeAction = completeActionWrapper!.getCompleteorchestration()!;
267269
expect(completeAction.getOrchestrationstatus()).toBe(pb.OrchestrationStatus.ORCHESTRATION_STATUS_FAILED);
268270
});
269271
});
@@ -319,9 +321,10 @@ describe("OrchestrationExecutor Entity Operation Events", () => {
319321
// Assert
320322
expect(result1).toBe(10);
321323
expect(result2).toBe(20);
322-
expect(actions2.length).toBe(1);
323-
expect(actions2[0].hasCompleteorchestration()).toBe(true);
324-
expect(actions2[0].getCompleteorchestration()!.getResult()?.getValue()).toBe("30");
324+
// Note: actions include previously-scheduled entity calls (idempotent, have sequence numbers)
325+
const completeAction = actions2.find((a) => a.hasCompleteorchestration());
326+
expect(completeAction).toBeDefined();
327+
expect(completeAction!.getCompleteorchestration()!.getResult()?.getValue()).toBe("30");
325328
});
326329
});
327330
});

0 commit comments

Comments
 (0)