Skip to content

🎥 Make videos programmatically with React

Discard changes to packages/lambda/src/shared/__mocks__/aws-clients.ts

Jonny Burger9e5ce762b3c5
diff --git a/packages/lambda/src/shared/__mocks__/aws-clients.ts b/packages/lambda/src/shared/__mocks__/aws-clients.ts
new file mode 100644
index 0000000000..097d3fb711
--- /dev/null
+++ b/packages/lambda/src/shared/__mocks__/aws-clients.ts
@@ -0,0 +1,31 @@
+import type {
+ InvokeWithResponseStreamCommandInput,
+ LambdaClient,
+} from '@aws-sdk/client-lambda';
+import type {getLambdaClient as original} from '../../shared/aws-clients';
+
+export const getLambdaClient: typeof original = (region, timeoutInTest) => {
+ return {
+ config: {
+ requestHandler: {},
+ apiVersion: 'fake',
+ },
+ destroy: () => undefined,
+ middlewareStack: undefined,
+ send: async (params: {
+ FunctionName: undefined;
+ Payload: InvokeWithResponseStreamCommandInput;
+ InvocationType: 'Event';
+ }) => {
+ // @ts-expect-error
+ const payload = JSON.parse(params.input.Payload);
+
+ const {handler} = await import('../../functions/index');
+
+ return handler(payload, {
+ invokedFunctionArn: 'arn:fake',
+ getRemainingTimeInMillis: () => timeoutInTest ?? 120000,
+ });
+ },
+ } as unknown as LambdaClient;
+};