@@ -3,6 +3,9 @@ import type {
33 PendingDecisionTaskStartEvent ,
44} from '../workflow-history.types' ;
55
6+ import { scheduleActivityTaskEvent } from './workflow-history-activity-events' ;
7+ import { scheduleDecisionTaskEvent } from './workflow-history-decision-events' ;
8+
69export const pendingActivityTaskStartEvent = {
710 eventId : null ,
811 computedEventId : 'pending-7' ,
@@ -94,3 +97,54 @@ export const pendingDecisionTaskStartEventWithStartedState = {
9497 } ,
9598 } ,
9699} as const satisfies PendingDecisionTaskStartEvent ;
100+
101+ // Factory functions for creating test data dynamically
102+
103+ export function createPendingActivity (
104+ scheduleId : string ,
105+ options ?: { activityId ?: string }
106+ ) : PendingActivityTaskStartEvent {
107+ return {
108+ ...pendingActivityTaskStartEvent ,
109+ computedEventId : `pending-${ scheduleId } ` ,
110+ pendingActivityTaskStartEventAttributes : {
111+ ...pendingActivityTaskStartEvent . pendingActivityTaskStartEventAttributes ,
112+ scheduleId,
113+ ...( options ?. activityId && { activityId : options . activityId } ) ,
114+ } ,
115+ } as PendingActivityTaskStartEvent ;
116+ }
117+
118+ export function createPendingDecision (
119+ scheduleId : string
120+ ) : PendingDecisionTaskStartEvent {
121+ return {
122+ ...pendingDecisionTaskStartEvent ,
123+ computedEventId : `pending-${ scheduleId } ` ,
124+ pendingDecisionTaskStartEventAttributes : {
125+ ...pendingDecisionTaskStartEvent . pendingDecisionTaskStartEventAttributes ,
126+ scheduleId,
127+ } ,
128+ } as PendingDecisionTaskStartEvent ;
129+ }
130+
131+ export function createScheduleActivityEvent (
132+ eventId : string ,
133+ options ?: { activityId ?: string }
134+ ) {
135+ return {
136+ ...scheduleActivityTaskEvent ,
137+ eventId,
138+ activityTaskScheduledEventAttributes : {
139+ ...scheduleActivityTaskEvent . activityTaskScheduledEventAttributes ,
140+ ...( options ?. activityId && { activityId : options . activityId } ) ,
141+ } ,
142+ } ;
143+ }
144+
145+ export function createScheduleDecisionEvent ( eventId : string ) {
146+ return {
147+ ...scheduleDecisionTaskEvent ,
148+ eventId,
149+ } ;
150+ }
0 commit comments