Skip to content

Commit

Permalink
fix logic, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rossedfort committed Sep 30, 2024
1 parent 0188777 commit 629c51a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 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,6 +85,15 @@ describe('eventIsFailureOrTimedOut', () => {
expect(eventIsFailureOrTimedOut(event)).toBe(false);
});

it('should return false if provided an event with workflowTaskFailedEventAttributes and has ResetWorkflow message', () => {
const event = {
workflowTaskFailedEventAttributes: {
failure: { message: 'ResetWorkflow' },
},
} as unknown as WorkflowEvent;
expect(eventIsFailureOrTimedOut(event)).toBe(false);
});

it('should return true if provided an event with childWorkflowExecutionFailedEventAttributes', () => {
const event = {
childWorkflowExecutionFailedEventAttributes: {},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utilities/is-event-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export const isPureWorkflowTaskFailedEvent =
export const isWorkflowTaskFailedEvent = (event: WorkflowEvent) => {
return (
isPureWorkflowTaskFailedEvent(event) &&
['UnhandledCommand', 'ResetWorkflow'].includes(
!['UnhandledCommand', 'ResetWorkflow'].includes(
event.workflowTaskFailedEventAttributes?.failure?.message,
)
);
Expand Down

0 comments on commit 629c51a

Please sign in to comment.