ORANGE MOCHA FRAPPUCCINO
A little library to build http verification tests quickly on top of mocha. Testing is a party, and everyone is invited!
install
npm install omf
use
var omf = ; var app = ; ;
Instead of passing in an express or http server listener as the first parameter, we can pass in the base url of any public website, and all the tests can still run. This way you can swap out your development app for one in production and use the same http tests as a verification tool for your live site.
var omf = ;var assert = ; ;
ORANGE MOCHA FRAPPUCCINO just uses a tiny bit of meta-programmy-bla-bla to reduce the boiler plate in set up & tear down of http tests...but you still have the entire mocha framework at your disposal. For example, you can still nest sub-contexts, do more setup/teardown, or whatever!
var omf = ;var assert = ; ;
Also, the requests are all sent using the request library. Anything you pass as the optional 2nd parameter will be passed straight into the request module.
;
Shorthand to just do the bare minimum sanity checks. These are all equal.
;
Sometimes you do not know the url ahead of time. ORANGE MOCHA FRAPPUCCINO supplies you with the same request object used in other tests so you can share a cookie jar and other things. Example:
//test login & post flow;
license
Copyright (c) 2012 Brian M. Carlson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.