Skip to content

Commit

Permalink
Add test to validate constructor doesn't throw if noValidate option…
Browse files Browse the repository at this point in the history
… is passed
  • Loading branch information
nibble-4bits committed Sep 16, 2023
1 parent b4b6d52 commit 71e712f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions __tests__/StateMachine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,31 @@ describe('State Machine', () => {
new StateMachine(stateMachineDefinition, stateMachineOptions);
}).not.toThrow();
});

test('should not throw if definition validation is completely turned off when creating instance', async () => {
const stateMachineDefinition: StateMachineDefinition = {
StartAt: 'FirstState',
States: {
FirstState: {
Type: 'Pass',
InputPath: 'invalidPath',
ResultPath: 'invalidPath',
OutputPath: 'invalidPath',
End: true,
},
UnreachableState: {
// @ts-expect-error Invalid state type
Type: 'InvalidType',
},
},
InvalidTopLevelField: {},
};
const stateMachineOptions = { validationOptions: { noValidate: true } };

expect(() => {
new StateMachine(stateMachineDefinition, stateMachineOptions);
}).not.toThrow();
});
});

describe('run()', () => {
Expand Down

0 comments on commit 71e712f

Please sign in to comment.