Run juggler tests for Cloudant (#1414)

This commit is contained in:
Janny 2017-07-11 14:56:39 -04:00 committed by GitHub
parent 5da8170d9e
commit b9129e6973
5 changed files with 122 additions and 108 deletions

View File

@ -51,7 +51,6 @@ describe('basic-querying', function() {
connectorCapabilities.geoPoint = (db.adapter.name != 'dashdb') && (db.adapter.name != 'db2') &&
(db.adapter.name != 'informix') && (db.adapter.name != 'cassandra');
if (connectorCapabilities.geoPoint) userModelDef.addressLoc = {type: 'GeoPoint'};
User = db.define('User', userModelDef);
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')},
}}, function(err, users) {
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) {
should.not.exist(err);
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'},
}}, function(err, users) {
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'},
}}, function(err, users) {
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'},
function(err, users) {
if (err) return done(err);
@ -937,7 +942,8 @@ describe('basic-querying', function() {
describe('findOne', function() {
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.findOne(function(e, u) {
should.not.exist(e);

View File

@ -175,6 +175,7 @@ describe('datatypes', function() {
describe('model option persistUndefinedAsNull', function() {
var TestModel, isStrict;
before(function(done) {
db = getSchema();
TestModel = db.define(
'TestModel',
{

View File

@ -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;
User.definition.settings.strict = true; // Change to test regression for issue #1252
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) {
Passport.find({
include: {

View File

@ -398,6 +398,7 @@ describe('manipulation', function() {
});
it('should save existing object', function(done) {
// Cloudant could not guarantee findOne always return the same item
Person.findOne(function(err, p) {
if (err) return done(err);
p.name = 'Hans';
@ -414,6 +415,7 @@ describe('manipulation', function() {
});
it('should save existing object (promise variant)', function(done) {
// Cloudant could not guarantee findOne always return the same item
Person.findOne()
.then(function(p) {
p.name = 'Fritz';

View File

@ -572,7 +572,8 @@ describe('relations', function() {
before(function(done) {
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,
default: function() {
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();
Article.findById(article.id, function(err, article) {
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) {
should.not.exist(e);
should.exist(supplier);
@ -3874,7 +3877,7 @@ describe('relations', function() {
companyBoardId = companyBoard.id;
should.not.exist(e);
should.exist(companyBoard);
companyBoard.boss.create({id: 'a01'}, function(err, account) {
companyBoard.boss.create({id: 'bossa01'}, function(err, account) {
companyBoard.boss(function(e, boss) {
bossId = boss.id;
should.not.exist(e);