Skip to content

Commit

Permalink
better check for reset
Browse files Browse the repository at this point in the history
  • Loading branch information
rossedfort committed Sep 30, 2024
1 parent 629c51a commit e4b3d31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/models/event-groups/get-event-in-group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ describe('eventIsFailureOrTimedOut', () => {
expect(eventIsFailureOrTimedOut(event)).toBe(false);
});

it('should return false if provided an event with workflowTaskFailedEventAttributes and has ResetWorkflow message', () => {
it('should return false if provided an event with workflowTaskFailedEventAttributes and has resetWorkflowFailureInfo', () => {
const event = {
workflowTaskFailedEventAttributes: {
failure: { message: 'ResetWorkflow' },
failure: { resetWorkflowFailureInfo: {} },
},
} as unknown as WorkflowEvent;
expect(eventIsFailureOrTimedOut(event)).toBe(false);
Expand Down
7 changes: 4 additions & 3 deletions src/lib/utilities/is-event-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,12 @@ export const isPureWorkflowTaskFailedEvent =
hasAttributes<WorkflowTaskFailedEvent>('workflowTaskFailedEventAttributes');

export const isWorkflowTaskFailedEvent = (event: WorkflowEvent) => {
console.log(event);
return (
isPureWorkflowTaskFailedEvent(event) &&
!['UnhandledCommand', 'ResetWorkflow'].includes(
event.workflowTaskFailedEventAttributes?.failure?.message,
)
event.workflowTaskFailedEventAttributes?.failure?.message !==
'UnhandledCommand' &&
!event.workflowTaskFailedEventAttributes?.failure?.resetWorkflowFailureInfo
);
};

Expand Down

0 comments on commit e4b3d31

Please sign in to comment.