Object # <Object> has no method type '

My test code

 var strategy = require('../lib'); var should = require("should"); describe('passport-twitter', function() { it('should export Strategy constructor directly from package', function() { console.log('strategy is',strategy); strategy.should.have.type('function'); }); it('should export Strategy constructor', function() { strategy.Strategy.should.have.type('function'); }); }); 

and when I run this test.it it gives me an error

 1) passport-twitter should export Strategy constructor directly from package: TypeError: Object #<Object> has no method 'type' at Context.<anonymous> (/home/ritesh/projects/passport-topcoder/test/module.test.js:7:26) at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:211:32) at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:358:10) at /usr/local/lib/node_modules/mocha/lib/runner.js:404:12 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14) at /usr/local/lib/node_modules/mocha/lib/runner.js:293:7 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:237:23) at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:261:5) at processImmediate [as _immediateCallback] (timers.js:330:15) 2) passport-twitter should export Strategy constructor: TypeError: Object #<Object> has no method 'type' at Context.<anonymous> (/home/ritesh/projects/passport-topcoder/test/module.test.js:11:35) at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:211:32) at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:358:10) at /usr/local/lib/node_modules/mocha/lib/runner.js:404:12 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14) at /usr/local/lib/node_modules/mocha/lib/runner.js:293:7 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:237:23) at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:261:5) at processImmediate [as _immediateCallback] (timers.js:330:15) 

but the type method is indicated in the documentation. How to get rid of this error .please help a little.

instead, when I try to run

aa

 var strategy = require('..'); var should = require("should"); describe('passport-twitter', function() { it('should export', function() { console.log('strategy is',strategy); 'xxxx'.should.have.type('function'); }); }); 

still i get an error

  1) passport-twitter should export: TypeError: Object #<Object> has no method 'type' at Context.<anonymous> (/home/ritesh/projects/passport-topcoder/test/module.test.js:7:23) at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:211:32) at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:358:10) at /usr/local/lib/node_modules/mocha/lib/runner.js:404:12 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14) at /usr/local/lib/node_modules/mocha/lib/runner.js:293:7 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:237:23) at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:261:5) at processImmediate [as _immediateCallback] (timers.js:330:15) 
+1
source share
1 answer

should.js has the following syntax:

 'xxxx'.should.be.type('string'); 

Document No..ed.js # type

0
source

All Articles