@middy/cache
Advanced tools
Comparing version 1.0.0-alpha.42 to 1.0.0-alpha.43
@@ -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" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9832
2
96