Improve test failure messages

Replace

    foo.count.should.equal(X)
    Uncaught TypeError: Cannot read property 'should' of undefined

with

    foo.should.have.property('count', X)`
    Uncaught AssertionError: expected 0 to have property count
This commit is contained in:
Miroslav Bajtoš 2015-03-23 08:44:53 +01:00
parent f7dc6fab90
commit 1fbaf4e382
1 changed files with 10 additions and 10 deletions

View File

@ -769,9 +769,9 @@ describe('manipulation', function () {
});
it('should only delete instances that satisfy the where condition', function (done) {
Person.deleteAll({name: 'John'}, function (err, data) {
Person.deleteAll({name: 'John'}, function (err, result) {
if (err) return done(err);
data.count.should.equal(1);
result.should.have.property('count', 1);
Person.find({where: {name: 'John'}}, function (err, data) {
if (err) return done(err);
data.should.have.length(0);
@ -785,9 +785,9 @@ describe('manipulation', function () {
});
it('should report zero deleted instances', function (done) {
Person.deleteAll({name: 'does-not-match'}, function (err, data) {
Person.deleteAll({name: 'does-not-match'}, function (err, result) {
if (err) return done(err);
data.count.should.equal(0);
result.should.have.property('count', 0);
Person.count(function(err, count) {
if (err) return done(err);
count.should.equal(2);
@ -797,9 +797,9 @@ describe('manipulation', function () {
});
it('should delete all instances when "where" is not provided', function(done) {
Person.deleteAll(function (err, data) {
Person.deleteAll(function (err, result) {
if (err) return done(err);
data.count.should.equal(2);
result.should.have.property('count', 2);
Person.count(function(err, count) {
if (err) return done(err);
count.should.equal(0);
@ -1039,7 +1039,7 @@ describe('manipulation', function () {
Person.update({name: 'Harry Hoe'}, {name: 'Marta Moe'}, function(err,
results) {
should.not.exist(err);
results.count.should.equal(0);
results.should.have.property('count', 0);
Person.find({where: {name: 'Harry Hoe'}}, function(err, people) {
should.not.exist(err);
people.should.be.empty;
@ -1053,7 +1053,7 @@ describe('manipulation', function () {
Person.update({name: 'Brett Boe'}, {name: 'Harry Hoe'}, function(err,
results) {
should.not.exist(err);
results.count.should.equal(1);
results.should.have.property('count', 1);
Person.find({where: {age: 19}}, function(err, people) {
should.not.exist(err);
people.should.have.length(1);
@ -1067,7 +1067,7 @@ describe('manipulation', function () {
function(done) {
Person.update({name: 'Harry Hoe'}, function(err, results) {
should.not.exist(err);
results.count.should.equal(5);
results.should.have.property('count', 5);
Person.find({where: {name: 'Brett Boe'}}, function(err, people) {
should.not.exist(err);
people.should.be.empty;
@ -1085,7 +1085,7 @@ describe('manipulation', function () {
Person.update({name: 'Brett Boe'}, {name: undefined, gender: 'male'},
function(err, results) {
should.not.exist(err);
results.count.should.equal(1);
results.should.have.property('count', 1)
Person.find({where: {name: 'Brett Boe'}}, function(err, people) {
should.not.exist(err);
people.should.have.length(1);