Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 1.24 KB

README.md

File metadata and controls

33 lines (25 loc) · 1.24 KB

zeit-node-server

An unofficial package allowing you to create Node Server instances of your Zeit @now/node lambdas.

Doing so allows you to write unit/integration tests for your routes.

npm MIT License Travis Codecov

Installation

npm install zeit-node-server

Example Jest Test

import { createServer } from 'zeit-now-node-server';
import listen from 'test-listen';
import axios from 'axios';
import routeUnderTest from './api/hello-world';

it('should allow me to test my node lambdas' async () => {
  const server = createServer(routeUnderTest);
  const url = await listen(server);
  const response = await axios.get(url);
  expect(response.data).toBe('Hello world');
  server.close();
});