Skip to content

Instantly share code, notes, and snippets.

@bouzuya
Created March 25, 2014 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouzuya/9759513 to your computer and use it in GitHub Desktop.
Save bouzuya/9759513 to your computer and use it in GitHub Desktop.
var expect = require('chai').expect;
describe('', function() {
it('', function() {
var f = function() {};
expect(f).to.have.property('prototype');
expect(f).to.have.deep.property('prototype.constructor', f);
var m = function() {};
f.prototype.m = m;
expect(f).to.have.property('prototype');
expect(f).to.have.deep.property('prototype.constructor', f);
expect(f).to.have.deep.property('prototype.m', m);
var o = new f();
expect(o).to.not.have.property('prototype');
expect(o).to.have.property('m', m);
expect(o).to.be.empty;
expect(o).to.have.property('constructor', f);
f.prototype.constructor = m;
expect(o).to.not.have.property('constructor', f);
expect(o).to.have.property('constructor', m);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment