Fix the perf around should.not.equal for complex objects
This commit is contained in:
parent
8d338eade9
commit
c9e78f6bd2
|
@ -13,16 +13,16 @@ describe('dataSource', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should clone existing model', function () {
|
it('should clone existing model', function () {
|
||||||
// Workaround for a possible bug in `should`
|
|
||||||
// where it takes ages to evaluate `should.equal` for complex objects
|
|
||||||
this.timeout(20000);
|
|
||||||
|
|
||||||
SlaveModel = slave.copyModel(Model);
|
SlaveModel = slave.copyModel(Model);
|
||||||
SlaveModel.dataSource.should.equal(slave);
|
SlaveModel.dataSource.should.equal(slave);
|
||||||
slave.should.not.equal(db);
|
// Workaround for an performance issue in `should` by customizing the msg
|
||||||
|
// where it takes ages to evaluate `should.not.equal` for complex objects
|
||||||
|
// https://github.com/shouldjs/should.js/blob/master/lib/assertion.js#L159-L162
|
||||||
|
slave.should.not.equal(db, 'The two data sources should be different');
|
||||||
var sm = new SlaveModel;
|
var sm = new SlaveModel;
|
||||||
sm.should.be.instanceOf(Model);
|
sm.should.be.instanceOf(Model);
|
||||||
sm.getDataSource().should.not.equal(db);
|
sm.getDataSource().should.not.equal(db, 'The data source of an instance ' +
|
||||||
|
'of the slave model should be different from the original one');
|
||||||
sm.getDataSource().should.equal(slave);
|
sm.getDataSource().should.equal(slave);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue