🎥 Make videos programmatically with React
fix types and mocks
Jonny Burger4e6a189231ff
diff --git a/packages/lambda/src/shared/__mocks__/bundle-site.ts b/packages/lambda/src/shared/__mocks__/bundle-site.tsindex 3be55293b3..fd43eeac47 100644--- a/packages/lambda/src/shared/__mocks__/bundle-site.ts+++ b/packages/lambda/src/shared/__mocks__/bundle-site.ts@@ -1,11 +1,35 @@-import type {bundle} from '@remotion/bundler';+import type {bundle, BundleOptions} from '@remotion/bundler';-export const bundleSite: typeof bundle = (entry: string) => {- if (entry === 'first') {+const convertArgumentsIntoOptions = (+ args: Parameters<typeof bundle>+): BundleOptions => {+ if ((args.length as number) === 0) {+ throw new TypeError('bundle() was called without arguments');+ }++ const firstArg = args[0];+ if (typeof firstArg === 'string') {+ return {+ entryPoint: firstArg,+ onProgress: args[1],+ ...(args[2] ?? {}),+ };+ }++ if (typeof firstArg.entryPoint !== 'string') {+ throw new TypeError('bundle() was called without the `entryPoint` option');+ }++ return firstArg;+};++export const bundleSite: typeof bundle = (...args) => {+ const {entryPoint} = convertArgumentsIntoOptions(args);+ if (entryPoint === 'first') {return Promise.resolve('/path/to/bundle-1');}- if (entry === 'second') {+ if (entryPoint === 'second') {return Promise.resolve('/path/to/bundle-2');}