Skip to content

Commit

Permalink
Add two more test cases for failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nakedible-p authored Oct 4, 2023
1 parent 3cc79b7 commit 6a7e75c
Showing 1 changed file with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ describe('Start Query Execution', () => {
});
});

test('execution parameters fails on invalid values', () => {
test('execution parameters fails on too long string', () => {
// GIVEN
const stack = new cdk.Stack();

Expand All @@ -358,4 +358,56 @@ describe('Start Query Execution', () => {
// THEN
}).toThrow(/length must be between 1 and 1024 characters/);
});

test('execution parameters fails on empty string', () => {
// GIVEN
const stack = new cdk.Stack();

expect(() => {
// WHEN
const task = new AthenaStartQueryExecution(stack, 'Query', {
queryString: 'CREATE DATABASE ?',
clientRequestToken: 'unique-client-request-token',
queryExecutionContext: {
databaseName: 'mydatabase',
catalogName: 'AwsDataCatalog',
},
resultConfiguration: {
outputLocation: {
bucketName: 'query-results-bucket',
objectKey: 'folder',
},
},
workGroup: 'primary',
executionParameters: [''],
});
// THEN
}).toThrow(/length must be between 1 and 1024 characters/);
});

test('execution parameters fails on empty list', () => {
// GIVEN
const stack = new cdk.Stack();

expect(() => {
// WHEN
const task = new AthenaStartQueryExecution(stack, 'Query', {
queryString: 'CREATE DATABASE ?',
clientRequestToken: 'unique-client-request-token',
queryExecutionContext: {
databaseName: 'mydatabase',
catalogName: 'AwsDataCatalog',
},
resultConfiguration: {
outputLocation: {
bucketName: 'query-results-bucket',
objectKey: 'folder',
},
},
workGroup: 'primary',
executionParameters: [],
});
// THEN
}).toThrow(/must be a non-empty list/);
});
});

0 comments on commit 6a7e75c

Please sign in to comment.