GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - apibyexample/abe-express: API By Example helper for testing Express API Routes.

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
libs
libs
 
 
test/unit
test/unit
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.jscsrc
.jscsrc
 
 
.jshintrc
.jshintrc
 
 
.npmignore
.npmignore
 
 
.travis.yml
.travis.yml
 
 
Gruntfile.js
Gruntfile.js
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
app.js
app.js
 
 
package.json
package.json
 
 

Repository files navigation

Build Status Dependency Status devDependency Status Monthly downloads License

API By Example helper for Express

This repository includes tools to be able to use the ABE format with a Node.js Express server. In particular we aim to support the testing of API routes to check that the responses match those expected created mocks which follow the ABE format.

Installing

npm install abe-express --save-dev

Usage

In order to use abe-express you will use this within your current testing setup

### Header test

This is a helper which will run a test against your API ensuring that the header response matches that of your mock. In order to do this, it will match the status code of your mock, it will also test the expected Content-type matches (this is only done if your mock contains the Content-type in it's headers).

var abeExpress = require('abe-express'),
    myApp = require('../app.js'),
    mock = require('../mocks/example.json'),
    example = 'OK';

it('Should return a 200 status code', function (done) {
    abeExpress.header(myApp, mock, example, done);
});

### Full test

This is a helper which will run all tests against your API, ensuring that the body response of your API matches that of your mock. It will also run the tests against the header.

var abeExpress = require('abe-express'),
    myApp = require('../app.js'),
    mock = require('../mocks/example.json'),
    example = 'OK';

it('Should return a 200 status code and body', function (done) {
    abeExpress.full(myApp, mock, example, done);
});

Params

App

This will be your Express app in which the route has been attached to in which you want to test.

Mock

This will be the full ABE-Spec mock in which you are wanting to test against.

Example

This is the key within the examples object of your mock.

Done

This is the function which your testing system will pass within a it test, to tell your test that it has completed.

About

API By Example helper for testing Express API Routes.

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

5 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.