Skip to content

TimPerry/jasmine-http-status-code-matcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jasmine HTTP status code matcher

Setup

Install via npm:

npm install --save-dev jasmine-http-status-code-matcher

import in node:

var customMatchers = require('jasmine-http-status-code-matcher');

tell jasmine to use the matchers:

jasmine.addMatchers(customMatchers);

Usage

Expect a status code to be a given status code

// res.statusCode = 204
expect(res.statusCode).toBeStatusCode(404);

would output:

Expected 204 (No Content) to be 404 (Not Found)

Also works with .not like this:

// res.statusCode = 204
expect(res.statusCode).not.toBeStatusCode(404);

would output:

Expected 204 (No Content) not to be 404 (Not Found)

About

HTTP status code matcher for jasmine (gives you the textual status as well as the provided number)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published