inherit.js 385 B

123456789101112131415161718192021
  1. /**
  2. * Module dependencies.
  3. */
  4. var inherit = require('..');
  5. describe('inherit(a, b)', function(){
  6. it('should inherit b\'s prototype', function(){
  7. function Loki(){}
  8. function Animal(){}
  9. Animal.prototype.species = 'unknown';
  10. inherit(Loki, Animal);
  11. var loki = new Loki;
  12. loki.species.should.equal('unknown');
  13. loki.constructor.should.equal(Loki);
  14. })
  15. })