You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var express = require('express') // express 4.2.0
var router = express.Router();
router.get('/:uuid/:item', function (req, res) {
res.end(300);
});
module.exports = router;
testcode.js
'use strict';
var expect = require('chai').expect;
var table = require('./product.js');
describe('table', function () {
it('should pass ', function (done) {
expect(1).to.equal(1);
table.handle( { url: '/test/pois',method:'GET'},
{
end: function(statusCode){
expect(statusCode).to.equal(200);
done();
}
}
);
});
});
the case should failed , i expect chai.expect tell me that 200 is not equals to 300.
but it throws error like bellow. ( then i change it to expect(statusCode).to.equal(300); verything is ok)
1) table should pass :
TypeError: undefined is not a function
at D:\git\Qbengo\sliteSerivce\node_modules\express\lib\router\index.js:137:5
at D:\git\Qbengo\sliteSerivce\node_modules\express\lib\router\index.js:250:10
at next (D:\git\Qbengo\sliteSerivce\node_modules\express\lib\router\index.js:160:14)
at next (D:\git\Qbengo\sliteSerivce\node_modules\express\lib\router\index.js:212:7)
at Function.proto.handle (D:\git\Qbengo\sliteSerivce\node_modules\express\lib\router\index.js:151:3)
at Context.<anonymous> (D:\git\Qbengo\sliteSerivce\test.js:11:11)
at Test.Runnable.run (D:\userdata\pshu\Application Data\npm\node_modules\mocha\lib\runnable.js:204:15)
at Runner.runTest (D:\userdata\pshu\Application Data\npm\node_modules\mocha\lib\runner.js:378:10)
at D:\userdata\pshu\Application Data\npm\node_modules\mocha\lib\runner.js:456:12
at next (D:\userdata\pshu\Application Data\npm\node_modules\mocha\lib\runner.js:303:14)
at D:\userdata\pshu\Application Data\npm\node_modules\mocha\lib\runner.js:313:7
at next (D:\userdata\pshu\Application Data\npm\node_modules\mocha\lib\runner.js:251:23)
at Object._onImmediate (D:\userdata\pshu\Application Data\npm\node_modules\mocha\lib\runner.js:280:5)
at processImmediate [as _immediateCallback] (timers.js:330:15)
The text was updated successfully, but these errors were encountered:
product.js
testcode.js
the case should failed , i expect
chai.expect
tell me that 200 is not equals to 300.but it throws error like bellow. ( then i change it to
expect(statusCode).to.equal(300);
verything is ok)The text was updated successfully, but these errors were encountered: