fix avoid duplicate record on scope with promise
This commit is contained in:
parent
3113333cb2
commit
0e89a9c837
|
@ -5109,14 +5109,11 @@ describe('relations', function() {
|
||||||
Category.findOne()
|
Category.findOne()
|
||||||
.then(function(cat) {
|
.then(function(cat) {
|
||||||
cat.jobIds = [job2.id, job2.id];
|
cat.jobIds = [job2.id, job2.id];
|
||||||
cat.save();
|
return cat.save();
|
||||||
})
|
})
|
||||||
.then(function(p) {
|
.then(
|
||||||
should.not.exist(p);
|
function(p) { done(new Error('save() should have failed')); },
|
||||||
done();
|
function(err) {
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
should.exist(err);
|
|
||||||
err.name.should.equal('ValidationError');
|
err.name.should.equal('ValidationError');
|
||||||
err.details.codes.jobs.should.eql(['uniqueness']);
|
err.details.codes.jobs.should.eql(['uniqueness']);
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in New Issue