
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.
appsync-template-tester
Advanced tools
Unit test AppSync VTL resolvers, with popular frameworks such as Jest
Unit test AppSync VTL resolvers, with popular frameworks such as Jest.
yarn add appsync-template-tester --dev
import Parser from 'appsync-template-tester';
import { readFileSync } from 'fs';
import { join } from 'path';
// Load from a file (if not in a string already)
const templateFilePath = join(__dirname, './pathToFile.vtl');
const template = readFileSync(templateFilePath);
// Create the resolver
const parser = new Parser(template);
test('Test the resolver', () => {
// The Appsync Context (ctx) object
const context = {
// For example with a dynamoDB response resolver:
result: {
id: 'testId',
// ...
},
};
// parser.resolve() automatically typecasts (note JSON becomes a JS object for ease of testing)
const response = parser.resolve(context);
// For convenience, the response is returned as a JS object rather than JSON
expect(response.id).toBe('testId');
});
This module supports all the provided core & time $util methods, and most of the dynamodb methods. The underlying methods can be seen in the Resolver Mapping Template Utility Reference docs.
Note: The errors list is also not returned (but $util.error will throw an error).
This module is contributed by the team at Skyhook.
FAQs
Unit test AppSync VTL resolvers, with popular frameworks such as Jest
The npm package appsync-template-tester receives a total of 458 weekly downloads. As such, appsync-template-tester popularity was classified as not popular.
We found that appsync-template-tester 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.