Run juggler tests for Cloudant (#1414)
This commit is contained in:
parent
5da8170d9e
commit
b9129e6973
|
@ -51,7 +51,6 @@ describe('basic-querying', function() {
|
||||||
connectorCapabilities.geoPoint = (db.adapter.name != 'dashdb') && (db.adapter.name != 'db2') &&
|
connectorCapabilities.geoPoint = (db.adapter.name != 'dashdb') && (db.adapter.name != 'db2') &&
|
||||||
(db.adapter.name != 'informix') && (db.adapter.name != 'cassandra');
|
(db.adapter.name != 'informix') && (db.adapter.name != 'cassandra');
|
||||||
if (connectorCapabilities.geoPoint) userModelDef.addressLoc = {type: 'GeoPoint'};
|
if (connectorCapabilities.geoPoint) userModelDef.addressLoc = {type: 'GeoPoint'};
|
||||||
|
|
||||||
User = db.define('User', userModelDef);
|
User = db.define('User', userModelDef);
|
||||||
db.automigrate(done);
|
db.automigrate(done);
|
||||||
});
|
});
|
||||||
|
@ -387,7 +386,8 @@ describe('basic-querying', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support date "lt" that is satisfied', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should support date "lt" that is satisfied', function(done) {
|
||||||
User.find({where: {birthday: {'lt': new Date('1980-12-07')},
|
User.find({where: {birthday: {'lt': new Date('1980-12-07')},
|
||||||
}}, function(err, users) {
|
}}, function(err, users) {
|
||||||
should.not.exist(err);
|
should.not.exist(err);
|
||||||
|
@ -464,7 +464,8 @@ describe('basic-querying', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support string "gte" that is satisfied', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should support string "gte" that is satisfied', function(done) {
|
||||||
User.find({where: {name: {'gte': 'Paul McCartney'}}}, function(err, users) {
|
User.find({where: {name: {'gte': 'Paul McCartney'}}}, function(err, users) {
|
||||||
should.not.exist(err);
|
should.not.exist(err);
|
||||||
users.should.have.property('length', 4);
|
users.should.have.property('length', 4);
|
||||||
|
@ -484,7 +485,8 @@ describe('basic-querying', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support string "gt" that is satisfied', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should support string "gt" that is satisfied', function(done) {
|
||||||
User.find({where: {name: {'gt': 'Paul McCartney'},
|
User.find({where: {name: {'gt': 'Paul McCartney'},
|
||||||
}}, function(err, users) {
|
}}, function(err, users) {
|
||||||
should.not.exist(err);
|
should.not.exist(err);
|
||||||
|
@ -496,7 +498,8 @@ describe('basic-querying', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support string "lt" that is satisfied', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should support string "lt" that is satisfied', function(done) {
|
||||||
User.find({where: {name: {'lt': 'Paul McCartney'},
|
User.find({where: {name: {'lt': 'Paul McCartney'},
|
||||||
}}, function(err, users) {
|
}}, function(err, users) {
|
||||||
should.not.exist(err);
|
should.not.exist(err);
|
||||||
|
@ -880,7 +883,9 @@ describe('basic-querying', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support nested property for order in query', function(done) {
|
bdd.itIf(connectorCapabilities.adhocSort,
|
||||||
|
'should support nested property for order in query',
|
||||||
|
function(done) {
|
||||||
User.find({where: {'address.state': 'CA'}, order: 'address.city DESC'},
|
User.find({where: {'address.state': 'CA'}, order: 'address.city DESC'},
|
||||||
function(err, users) {
|
function(err, users) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
@ -937,7 +942,8 @@ describe('basic-querying', function() {
|
||||||
describe('findOne', function() {
|
describe('findOne', function() {
|
||||||
before(seed);
|
before(seed);
|
||||||
|
|
||||||
it('should find first record (default sort by id)', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should find first record (default sort by id)', function(done) {
|
||||||
User.all({order: 'id'}, function(err, users) {
|
User.all({order: 'id'}, function(err, users) {
|
||||||
User.findOne(function(e, u) {
|
User.findOne(function(e, u) {
|
||||||
should.not.exist(e);
|
should.not.exist(e);
|
||||||
|
|
|
@ -175,6 +175,7 @@ describe('datatypes', function() {
|
||||||
describe('model option persistUndefinedAsNull', function() {
|
describe('model option persistUndefinedAsNull', function() {
|
||||||
var TestModel, isStrict;
|
var TestModel, isStrict;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
db = getSchema();
|
||||||
TestModel = db.define(
|
TestModel = db.define(
|
||||||
'TestModel',
|
'TestModel',
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,7 +84,9 @@ describe('include', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not save in db included models, in query returned models', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should not save in db included models, in query returned models',
|
||||||
|
function(done) {
|
||||||
const originalStrict = User.definition.settings.strict;
|
const originalStrict = User.definition.settings.strict;
|
||||||
User.definition.settings.strict = true; // Change to test regression for issue #1252
|
User.definition.settings.strict = true; // Change to test regression for issue #1252
|
||||||
const finish = (err) => {
|
const finish = (err) => {
|
||||||
|
@ -309,7 +311,7 @@ describe('include', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
bdd.itIf(connectorCapabilities.adhocSort === false,
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
'should support limit - no sort', function(done) {
|
'should support limit - no sort', function(done) {
|
||||||
Passport.find({
|
Passport.find({
|
||||||
include: {
|
include: {
|
||||||
|
|
|
@ -398,6 +398,7 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should save existing object', function(done) {
|
it('should save existing object', function(done) {
|
||||||
|
// 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);
|
||||||
p.name = 'Hans';
|
p.name = 'Hans';
|
||||||
|
@ -414,6 +415,7 @@ describe('manipulation', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should save existing object (promise variant)', function(done) {
|
it('should save existing object (promise variant)', function(done) {
|
||||||
|
// Cloudant could not guarantee findOne always return the same item
|
||||||
Person.findOne()
|
Person.findOne()
|
||||||
.then(function(p) {
|
.then(function(p) {
|
||||||
p.name = 'Fritz';
|
p.name = 'Fritz';
|
||||||
|
|
|
@ -572,7 +572,8 @@ describe('relations', function() {
|
||||||
|
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
Physician = db.define('Physician', {name: String});
|
Physician = db.define('Physician', {name: String});
|
||||||
Patient = db.define('Patient', {name: String, age: Number, sequence: Number});
|
Patient = db.define('Patient', {name: String, age: Number,
|
||||||
|
sequence: {type: Number, index: true}});
|
||||||
Appointment = db.define('Appointment', {date: {type: Date,
|
Appointment = db.define('Appointment', {date: {type: Date,
|
||||||
default: function() {
|
default: function() {
|
||||||
return new Date();
|
return new Date();
|
||||||
|
@ -2933,7 +2934,8 @@ describe('relations', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find polymorphic items - article', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should find polymorphic items - article', function(done) {
|
||||||
if (!article) return done();
|
if (!article) return done();
|
||||||
Article.findById(article.id, function(err, article) {
|
Article.findById(article.id, function(err, article) {
|
||||||
article.pictures(function(err, pics) {
|
article.pictures(function(err, pics) {
|
||||||
|
@ -3821,7 +3823,8 @@ describe('relations', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get the related item on scope - verify', function(done) {
|
bdd.itIf(connectorCapabilities.cloudantCompatible !== false,
|
||||||
|
'should get the related item on scope - verify', function(done) {
|
||||||
Supplier.findById(supplierId, function(e, supplier) {
|
Supplier.findById(supplierId, function(e, supplier) {
|
||||||
should.not.exist(e);
|
should.not.exist(e);
|
||||||
should.exist(supplier);
|
should.exist(supplier);
|
||||||
|
@ -3874,7 +3877,7 @@ describe('relations', function() {
|
||||||
companyBoardId = companyBoard.id;
|
companyBoardId = companyBoard.id;
|
||||||
should.not.exist(e);
|
should.not.exist(e);
|
||||||
should.exist(companyBoard);
|
should.exist(companyBoard);
|
||||||
companyBoard.boss.create({id: 'a01'}, function(err, account) {
|
companyBoard.boss.create({id: 'bossa01'}, function(err, account) {
|
||||||
companyBoard.boss(function(e, boss) {
|
companyBoard.boss(function(e, boss) {
|
||||||
bossId = boss.id;
|
bossId = boss.id;
|
||||||
should.not.exist(e);
|
should.not.exist(e);
|
||||||
|
|
Loading…
Reference in New Issue