diff --git a/src/__tests__/lambdaHandler.spec.js b/src/__tests__/lambdaHandler.spec.js index f621379..6554735 100644 --- a/src/__tests__/lambdaHandler.spec.js +++ b/src/__tests__/lambdaHandler.spec.js @@ -197,27 +197,6 @@ describe("Lambda Handler Module", () => { // Assert expect(jaypieHandler).not.toHaveBeenCalled(); }); - it("Re-uses Jaypie handlers", async () => { - // Arrange - const mockFunction = vi.fn(); - // Act - const handler1 = lambdaHandler(mockFunction); - const handler2 = lambdaHandler(mockFunction); - // Assert - expect(jaypieHandler).not.toHaveBeenCalled(); - // Act - await handler1(); - expect(jaypieHandler).toHaveBeenCalledTimes(1); - // Act - await handler2(); - // Assert - expect(jaypieHandler).toHaveBeenCalledTimes(2); - // Act - await handler1(); - await handler2(); - // Assert - expect(jaypieHandler).toHaveBeenCalledTimes(2); - }); }); }); }); diff --git a/src/lambdaHandler.js b/src/lambdaHandler.js index 61c247a..26e2351 100644 --- a/src/lambdaHandler.js +++ b/src/lambdaHandler.js @@ -31,8 +31,6 @@ const lambdaHandler = ( // Setup // - let jaypieFunction; - return async (event = {}, context = {}, ...args) => { if (!name) { // If handler has a name, use it @@ -69,7 +67,7 @@ const lambdaHandler = ( // Preprocess // - jaypieFunction = jaypieHandler(handler, { + const jaypieFunction = jaypieHandler(handler, { name, setup, teardown,