
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
lambda-test
Advanced tools
Simple Serverless tester, which works like this:
const lambdaTest = require('lambda-test');
const { getById } = require('../../routes/users.js');
describe('GET /users/{id}', () => {
it('should get user by id', async () => {
const response = await lambdaTest(getById)
.pathParameters({ id: 123 })
.run();
})
});
or much more sophisticated with Api Blueprint check
const assert = require('assert');
const { LambdaTest } = require('lambda-test');
const { updateById } = require('../../routes/users.js');
// in project root
const tester = new LambdaTest('./apiBlueprint.apib');
describe('UPDATE /users/{id}', () => {
it('should get user by id', async () => {
const response = await tester.test(updateById, '/users/{id}', 'UPDATE', 200)
.pathParameters({ id: 123 })
.queryStringParameters({ fields: 'name' })
.headers({ Authorization: 'secret' })
.body({ name: 'John Doe' })
.verify();
assert.equal(response.body.name, 'John Doe');
});
});
Kind: global class
Param | Type | Default | Description |
---|---|---|---|
[blueprintFile] | string | null | api blueprint |
ApiBlueprint
Kind: instance method of LambdaTest
HandlerTester
Create test and checks for status code
when first parameter is API path, response is checked against api blueprint
Kind: instance method of LambdaTest
Param | Type | Default | Description |
---|---|---|---|
handler | function | function to test | |
[routeOrStatus] | number | string | 200 | route path for blueprint or status code |
[httpMethod] | string | null | http method to use |
[statusCode] | number | null |
| expected status code |
Kind: global class
this
this
this
this
Promise.<Object>
Promise.<Object>
Param | Type | Default |
---|---|---|
handler | function | |
[statusCode] | number | null |
|
[httpMethod] | string | null | null |
[route] | string | null | null |
[api] | ApiBlueprint | null |
|
this
Sets query string
Kind: instance method of HandlerTester
Param | Type | Default | Description |
---|---|---|---|
query | Object | null |
| the query string |
this
Sets request body
Kind: instance method of HandlerTester
Param | Type | Default | Description |
---|---|---|---|
body | Object | string |
| request body |
this
Set request headers
Kind: instance method of HandlerTester
Param | Type | Default |
---|---|---|
headers | Object | null |
|
this
Kind: instance method of HandlerTester
Param | Type | Default |
---|---|---|
params | Object | null |
|
Promise.<Object>
Send request
Kind: instance method of HandlerTester
Promise.<Object>
Send request
Kind: instance method of HandlerTester
FAQs
Simple Serverless tester, which works like this:
The npm package lambda-test receives a total of 12 weekly downloads. As such, lambda-test popularity was classified as not popular.
We found that lambda-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.