// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
// division-by-zero-test.js var vows = require ( 'vows' ) , assert = require ( 'assert' ) ; // Create a Test Suite vows. describe ( 'Division by Zero' ) . addBatch ( { 'when dividing a number by zero' : { topic : function ( ) { return 42 / 0 } , 'we get Infinity' : function ( topic ) { assert. equal ( topic , Infinity ) ; } } , 'but when dividing zero by zero' : { topic : function ( ) { return 0 / 0 } , 'we get a value which' : { 'is not a number' : function ( topic ) { assert. isNaN ( topic ) ; } , 'is not equal to itself' : function ( topic ) { assert. notEqual ( topic , topic ) ; } } } } ) . run ( ) ; // Run it
- { 'GET /' : {
- topic : api. get ( '/' ) ,
- 'shoud respond with a 200 OK' : assertStatus ( 200 )
- } ,
- 'POST /' : {
- topic : api. post ( '/' ) ,
- 'shoud respond with a 405 Method not allowed' : assertStatus ( 405 )
- } ,
- 'GET / resources (no api-key)' : {
- topic : api. get ( '/ resources' ) ,
- 'shoud respond with a 403 Forbidden' : assertStatus ( 403 )
- } ,
- 'GET / resources? Apikey = af816e859c249fe'
- topic : api. get ( '/ resources? apikey = af816e859c249fe' ) ,
- 'shoud return a 200 OK' : assertStatus ( 200 ) ,
- 'should return a list of resources' : function ( res ) {
- assert. isArray ( res. body ) ;
- }
- }
- }
- // or even
- {
- 'GET /' : respondsWith ( 200 ) ,
- 'POST /' : respondsWith ( 405 ) ,
- 'GET / resources (no key)' : respondsWith ( 403 )
- }
Source: https://habr.com/ru/post/98671/
All Articles