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

appsync-template-tester

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appsync-template-tester

Test appsync VTL resolvers, with popular frameworks such as Jest

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
603
decreased by-3.52%
Maintainers
1
Weekly downloads
 
Created
Source

appsync-template-tester

Built with
typescript version dependants license

Use

Example

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',
      // ...
    },
  };

  const response = parser.resolve(context);

  // For convenience, the response is returned as a JS object rather than JSON
  expect(response.id).toBe('testId');
});

Util helpers supported

This module supports all the core provided $util methods, which can be seen in the Resolver Mapping Template Utility Reference docs.

Note: The errors list is not exported (and cannot be without modifying the velocityjs compiler).

Skyhook CD Checklist

CD FeatureProvided
Typescript
Linting (AirBnB + Prettier)
Unit tests (Jest)
Coverage check (ideally 100% with Jest)
Github Continuous Deployment

Built by Skyhook

This module is contributed by the team at Skyhook.

Keywords

FAQs

Package last updated on 07 May 2020

Did you know?

Socket

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.

Install

Related posts

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