Skip to content

Commit

Permalink
some type tweaks with improved AwsEvent interfaces now in place.
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj committed Oct 2, 2024
1 parent f829e88 commit bd6ffb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions test/unit/helpers/receivers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import crypto from 'node:crypto';
import { EventEmitter } from 'node:events';
import sinon, { type SinonSpy } from 'sinon';
import type App from '../../../src/App';
import type { AwsEvent } from '../../../src/receivers/AwsLambdaReceiver';
import type { Receiver, ReceiverEvent } from '../../../src/types';
import type { Override } from './app';

Expand Down Expand Up @@ -74,7 +75,7 @@ export function createDummyAWSPayload(
timestamp: number = Math.floor(Date.now() / 1000),
headers?: Record<string, string>,
isBase64Encoded = false,
) {
): AwsEvent {
const signature = crypto.createHmac('sha256', 'my-secret').update(`v0:${timestamp}:${body}`).digest('hex');
const realBody = isBase64Encoded ? Buffer.from(body).toString('base64') : body;
return {
Expand All @@ -91,7 +92,7 @@ export function createDummyAWSPayload(
},
multiValueHeaders: {},
queryStringParameters: {},
multiValueQueryStringParameters: null,
multiValueQueryStringParameters: {},
pathParameters: null,
stageVariables: null,
requestContext: {},
Expand Down
2 changes: 1 addition & 1 deletion test/unit/receivers/AwsLambdaReceiver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe('AwsLambdaReceiver', () => {
},
multiValueHeaders: {},
queryStringParameters: {},
multiValueQueryStringParameters: null,
multiValueQueryStringParameters: {},
pathParameters: null,
stageVariables: null,
requestContext: {},
Expand Down

0 comments on commit bd6ffb4

Please sign in to comment.