Skip to content

Commit

Permalink
fix: unit test for StartingPositionTimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
overbit committed Oct 27, 2022
1 parent 7e829f7 commit cebb796
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions test/unit/lib/plugins/aws/package/compile/events/kafka.test.js
Expand Up @@ -536,7 +536,7 @@ describe('test/unit/lib/plugins/aws/package/compile/events/kafka.test.js', () =>
describe('startingPositionTimestamp', () => {
it('should fail to compile EventSourceMapping resource properties for startingPosition AT_TIMESTAMP with no startingPositionTimestamp', async () => {
await expect(
await runServerless({
runServerless({
fixture: 'function',
configExt: {
functions: {
Expand All @@ -561,35 +561,35 @@ describe('test/unit/lib/plugins/aws/package/compile/events/kafka.test.js', () =>
code: 'FUNCTION_KAFKA_STARTING_POSITION_TIMESTAMP_INVALID',
});
});
});

it('should correctly compile EventSourceMapping resource properties for startingPosition', async () => {
const { awsNaming, cfTemplate } = await runServerless({
fixture: 'function',
configExt: {
functions: {
basic: {
role: { 'Fn::ImportValue': 'MyImportedRole' },
events: [
{
kafka: {
topic,
bootstrapServers: ['abc.xyz:9092'],
accessConfigurations: { saslScram256Auth: saslScram256AuthArn },
startingPosition: 'AT_TIMESTAMP',
startingPositionTimestamp: 123,
it('should correctly compile EventSourceMapping resource properties for startingPosition', async () => {
const { awsNaming, cfTemplate } = await runServerless({
fixture: 'function',
configExt: {
functions: {
basic: {
role: { 'Fn::ImportValue': 'MyImportedRole' },
events: [
{
kafka: {
topic,
bootstrapServers: ['abc.xyz:9092'],
accessConfigurations: { saslScram256Auth: saslScram256AuthArn },
startingPosition: 'AT_TIMESTAMP',
startingPositionTimestamp: 123,
},
},
},
],
],
},
},
},
},
command: 'package',
});
command: 'package',
});

const eventSourceMappingResource =
cfTemplate.Resources[awsNaming.getKafkaEventLogicalId('basic', 'TestingTopic')];
expect(eventSourceMappingResource.Properties.StartingPositionTimestamp).to.deep.equal(123);
const eventSourceMappingResource =
cfTemplate.Resources[awsNaming.getKafkaEventLogicalId('basic', 'TestingTopic')];
expect(eventSourceMappingResource.Properties.StartingPositionTimestamp).to.deep.equal(123);
});
});

it('should not add dependsOn for imported role', async () => {
Expand Down

0 comments on commit cebb796

Please sign in to comment.