fix avoid duplicate record on scope with promise
This commit is contained in:
parent
3113333cb2
commit
0e89a9c837
|
@ -5107,20 +5107,17 @@ describe('relations', function() {
|
||||||
|
|
||||||
it('should not allow duplicate record on scope with promises', function(done) {
|
it('should not allow duplicate record on scope with promises', function(done) {
|
||||||
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) {
|
||||||
})
|
err.name.should.equal('ValidationError');
|
||||||
.catch(function(err) {
|
err.details.codes.jobs.should.eql(['uniqueness']);
|
||||||
should.exist(err);
|
done();
|
||||||
err.name.should.equal('ValidationError');
|
});
|
||||||
err.details.codes.jobs.should.eql(['uniqueness']);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find items on scope with promises', function(done) {
|
it('should find items on scope with promises', function(done) {
|
||||||
|
|
Loading…
Reference in New Issue