Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinZZ committed Dec 10, 2024
1 parent b3b6322 commit 4ce6094
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,42 @@ test('Invoke glue job with just job ARN', () => {
});
});

test('Invoke glue job with dynamic worker type', () => {
const task = new GlueStartJobRun(stack, 'Task', {
glueJobName,
workerConfiguration: {
workerType: WorkerType.of(sfn.JsonPath.stringAt('$.workerType')),
numberOfWorkers: 2,
},
});

new sfn.StateMachine(stack, 'SM', {
definitionBody: sfn.DefinitionBody.fromChainable(task),
});

expect(stack.resolve(task.toStateJson())).toEqual({
Type: 'Task',
Resource: {
'Fn::Join': [
'',
[
'arn:',
{
Ref: 'AWS::Partition',
},
':states:::glue:startJobRun',
],
],
},
End: true,
Parameters: {
'JobName': glueJobName,
'NumberOfWorkers': 2,
'WorkerType.$': '$.workerType',
},
});
});

test('Invoke glue job with full properties', () => {
const jobArguments = {
key: 'value',
Expand Down

0 comments on commit 4ce6094

Please sign in to comment.