Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@middy/cache

Package Overview
Dependencies
Maintainers
10
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@middy/cache - npm Package Compare versions

Comparing version 1.0.0-alpha.42 to 1.0.0-alpha.43

33

__tests__/index.js

@@ -0,1 +1,2 @@

const { invoke } = require('../../test-helpers')
const middy = require('../../core')

@@ -5,3 +6,3 @@ const cache = require('../')

describe('💽 Cache stuff', () => {
test('It should cache things using the default settings', (endTest) => {
test('It should cache things using the default settings', async () => {
const originalHandler = jest.fn((event, context, cb) => {

@@ -15,13 +16,11 @@ cb(null, event.a + event.b)

const event = { a: 2, b: 3 }
const context = {}
handler(event, context, (_, response) => {
handler(event, context, (_, response2) => {
expect(response).toEqual(response2)
expect(originalHandler.mock.calls.length).toBe(1)
endTest()
})
})
const response = await invoke(handler, event)
const response2 = await invoke(handler, event)
expect(response).toEqual(response2)
expect(originalHandler.mock.calls.length).toBe(1)
})
test('It should cache things using custom cache settings', (endTest) => {
test('It should cache things using custom cache settings', async () => {
const calculateCacheId = (event) => Promise.resolve(event.id)

@@ -51,11 +50,9 @@ const myStorage = {}

const event = { id: 'some_unique_id', a: 2, b: 3 }
const context = {}
handler(event, context, (_, response) => {
handler(event, context, (_, response2) => {
expect(response).toEqual(response2)
expect(originalHandler.mock.calls.length).toBe(1)
endTest()
})
})
const response = await invoke(handler, event)
const response2 = await invoke(handler, event)
expect(response).toEqual(response2)
expect(originalHandler.mock.calls.length).toBe(1)
})
})
{
"name": "@middy/cache",
"version": "1.0.0-alpha.42",
"version": "1.0.0-alpha.43",
"description": "Cache middleware for the middy framework",

@@ -44,5 +44,6 @@ "engines": {

"devDependencies": {
"@middy/core": "^1.0.0-alpha.42"
"@middy/core": "^1.0.0-alpha.43",
"es6-promisify": "^6.0.2"
},
"gitHead": "c9e64d026e86359bb3f78c4a3783569e1241728c"
"gitHead": "d6bbe8d97ee90856bb5a4da07ccb81d1a570a513"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc