parent
b9129e6973
commit
6a1b55568c
|
@ -397,7 +397,8 @@ describe('manipulation', function() {
|
||||||
.catch(done);
|
.catch(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should save existing object', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should save existing object', function(done) {
|
||||||
// Cloudant could not guarantee findOne always return the same item
|
// Cloudant could not guarantee findOne always return the same item
|
||||||
Person.findOne(function(err, p) {
|
Person.findOne(function(err, p) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
@ -414,7 +415,8 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should save existing object (promise variant)', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should save existing object (promise variant)', function(done) {
|
||||||
// Cloudant could not guarantee findOne always return the same item
|
// Cloudant could not guarantee findOne always return the same item
|
||||||
Person.findOne()
|
Person.findOne()
|
||||||
.then(function(p) {
|
.then(function(p) {
|
||||||
|
@ -577,7 +579,8 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should discard undefined values before strict validation',
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should discard undefined values before strict validation',
|
||||||
function(done) {
|
function(done) {
|
||||||
Person.definition.settings.strict = true;
|
Person.definition.settings.strict = true;
|
||||||
Person.findById(person.id, function(err, p) {
|
Person.findById(person.id, function(err, p) {
|
||||||
|
@ -1000,7 +1003,10 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!getSchema().connector.replaceById) {
|
var hasReplaceById = connectorCapabilities.cloudantCompatible !== false &&
|
||||||
|
!!getSchema().connector.replaceById;
|
||||||
|
|
||||||
|
if (!hasReplaceById) {
|
||||||
describe.skip('replaceById - not implemented', function() {});
|
describe.skip('replaceById - not implemented', function() {});
|
||||||
} else {
|
} else {
|
||||||
describe('replaceOrCreate', function() {
|
describe('replaceOrCreate', function() {
|
||||||
|
@ -1223,8 +1229,6 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasReplaceById = !!getSchema().connector.replaceById;
|
|
||||||
|
|
||||||
bdd.describeIf(hasReplaceById && connectorCapabilities.supportForceId !== false, 'replaceOrCreate ' +
|
bdd.describeIf(hasReplaceById && connectorCapabilities.supportForceId !== false, 'replaceOrCreate ' +
|
||||||
'when forceId is true', function() {
|
'when forceId is true', function() {
|
||||||
var Post, unknownId;
|
var Post, unknownId;
|
||||||
|
@ -1273,7 +1277,7 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!getSchema().connector.replaceById) {
|
if (!hasReplaceById) {
|
||||||
describe.skip('replaceAttributes/replaceById - not implemented', function() {});
|
describe.skip('replaceAttributes/replaceById - not implemented', function() {});
|
||||||
} else {
|
} else {
|
||||||
describe('replaceAttributes', function() {
|
describe('replaceAttributes', function() {
|
||||||
|
@ -1470,7 +1474,6 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hasReplaceById = !!getSchema().connector.replaceById;
|
|
||||||
bdd.describeIf(hasReplaceById, 'replaceById', function() {
|
bdd.describeIf(hasReplaceById, 'replaceById', function() {
|
||||||
var Post;
|
var Post;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
@ -2202,8 +2205,8 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
bdd.itIf(connectorCapabilities.updateWithoutId !== false, 'should update all instances when ' +
|
bdd.itIf(connectorCapabilities.updateWithoutId !== false,
|
||||||
'the where condition is not provided', function(done) {
|
'should update all instances when the where condition is not provided', function(done) {
|
||||||
filterHarry = connectorCapabilities.deleteWithOtherThanId === false ?
|
filterHarry = connectorCapabilities.deleteWithOtherThanId === false ?
|
||||||
{id: idHarry} : {name: 'Harry Hoe'};
|
{id: idHarry} : {name: 'Harry Hoe'};
|
||||||
filterBrett = connectorCapabilities.deleteWithOtherThanId === false ?
|
filterBrett = connectorCapabilities.deleteWithOtherThanId === false ?
|
||||||
|
@ -2248,9 +2251,9 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('upsertWithWhere', function() {
|
describe('upsertWithWhere', function() {
|
||||||
var ds = getSchema();
|
var ds, Person;
|
||||||
var Person;
|
|
||||||
before('prepare "Person" model', function(done) {
|
before('prepare "Person" model', function(done) {
|
||||||
|
ds = getSchema();
|
||||||
Person = ds.define('Person', {
|
Person = ds.define('Person', {
|
||||||
id: {type: Number, id: true},
|
id: {type: Number, id: true},
|
||||||
name: {type: String},
|
name: {type: String},
|
||||||
|
|
Loading…
Reference in New Issue