rethinkdbdash
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -1008,3 +1008,7 @@ var helper = require(__dirname+'/helper.js'); | ||
if (Array.isArray(term)) { | ||
if (specialType[term[0]]) { | ||
if (term.length === 0) { | ||
var underline = Array.isArray(frames) && (frames.length === 0); | ||
carify(result, 'undefined', underline); | ||
} | ||
else if (specialType[term[0]]) { | ||
backtrace = specialType[term[0]](term, index, father, frames, options); | ||
@@ -1011,0 +1015,0 @@ result.str = backtrace.str; |
@@ -203,2 +203,8 @@ var Promise = require('bluebird'); | ||
}; | ||
r.prototype.union = function() { | ||
var _len = arguments.length;var _args = new Array(_len); for(var _i = 0; _i < _len; _i++) {_args[_i] = arguments[_i];} | ||
var term = new Term(this).expr(_args[0]); | ||
return term.union.apply(term, _args.slice(1)); | ||
}; | ||
r.prototype.add = function() { | ||
@@ -357,3 +363,3 @@ var _len = arguments.length;var _args = new Array(_len); for(var _i = 0; _i < _len; _i++) {_args[_i] = arguments[_i];} | ||
} | ||
return new Term(this).branch(predicate, trueBranch, falseBranch); | ||
return new Term(this).expr(predicate).branch(trueBranch, falseBranch); | ||
} | ||
@@ -360,0 +366,0 @@ r.prototype.error = function(errorStr) { |
{ | ||
"name": "rethinkdbdash", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "A Node.js driver for RethinkDB with promises and a connection pool", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -107,13 +107,12 @@ var config = require(__dirname+'/config.js'); | ||
}) | ||
It('`branch` is not defined after a term', function* (done) { | ||
It('`branch` is defined after a term', function* (done) { | ||
try { | ||
result = yield r.expr(1).branch(true, true, true).run(); | ||
result = yield r.expr(true).branch(2, 3).run(); | ||
assert.equal(result, 2); | ||
result = yield r.expr(false).branch(2, 3).run(); | ||
assert.equal(result, 3); | ||
done(); | ||
} | ||
catch(e) { | ||
if (e.message === "`branch` is not defined after:\nr.expr(1)") { | ||
done() | ||
} | ||
else { | ||
done(e) | ||
} | ||
done(e); | ||
} | ||
@@ -120,0 +119,0 @@ }) |
@@ -54,3 +54,3 @@ var config = require('./config.js'); | ||
result = yield r.db(dbName).table(tableName).update({ | ||
date: r.now().sub(r.random()*1000000), | ||
date: r.now().sub(r.random().mul(1000000)), | ||
value: r.random() | ||
@@ -57,0 +57,0 @@ }, {nonAtomic: true}).run(); |
@@ -161,3 +161,3 @@ var config = require(__dirname+'/config.js'); | ||
catch(e) { | ||
if (e.message === "Cannot convert `NaN` to JSON.") { | ||
if (e.message.match(/^Cannot convert `NaN` to JSON/)) { | ||
done(); | ||
@@ -187,3 +187,3 @@ } | ||
catch(e) { | ||
if (e.message === "Cannot convert `Infinity` to JSON.") { | ||
if (e.message.match(/^Cannot convert `Infinity` to JSON/)) { | ||
done(); | ||
@@ -256,2 +256,4 @@ } | ||
/* | ||
// RethinkDB seems to properly handle the null character now | ||
It("Null char in string - 1", function* (done) { | ||
@@ -264,4 +266,9 @@ try{ | ||
catch(e) { | ||
assert.equal(e.message, 'The null character is currently not supported by RethinkDB.'); | ||
done(); | ||
if (e.message.match(/^The null character is currently not supported by RethinkDB/)) { | ||
done(); | ||
} | ||
else { | ||
console.log(e.message); | ||
done(e); | ||
} | ||
} | ||
@@ -271,3 +278,5 @@ }) | ||
try{ | ||
result = yield r.json(JSON.stringify('"T\u0000EST"')).run(); | ||
result = yield r.expr(1).do(function(key) { | ||
return r.json(JSON.stringify('"T\u0000EST"')) | ||
}).run(); | ||
assert.equal(result, JSON.stringify("T\u0000EST")); | ||
@@ -277,4 +286,9 @@ done(new Error('Was expecting an error')); | ||
catch(e) { | ||
assert.equal(e.message, 'The null character is currently not supported by RethinkDB.'); | ||
done(); | ||
if (e.message.match(/^The null character is currently not supported by RethinkDB/)) { | ||
done(); | ||
} | ||
else { | ||
console.log(e.message); | ||
done(e); | ||
} | ||
} | ||
@@ -289,4 +303,9 @@ }) | ||
catch(e) { | ||
assert.equal(e.message, 'The null character is currently not supported by RethinkDB.'); | ||
done(); | ||
if (e.message.match(/^The null character is currently not supported by RethinkDB/)) { | ||
done(); | ||
} | ||
else { | ||
console.log(e.message); | ||
done(e); | ||
} | ||
} | ||
@@ -303,1 +322,2 @@ }) | ||
}); | ||
*/ |
@@ -46,3 +46,3 @@ var config = require(__dirname+'/config.js'); | ||
catch(e) { | ||
if (e.message === "Annonymous function returned `undefined`. Did you forget a `return`?") { | ||
if (e.message === "Annonymous function returned `undefined`. Did you forget a `return`? In:\nfunction () {}.") { | ||
done() | ||
@@ -49,0 +49,0 @@ } |
@@ -40,5 +40,2 @@ var config = require(__dirname+'/config.js'); | ||
assert.equal(result, 1); | ||
assert(r.getPool().getAvailableLength() >= 2); // This can be 2 because r.expr(1) may be run BEFORE a connection in the buffer is available | ||
assert(r.getPool().getAvailableLength() <= r.getPool().getLength()) | ||
done() | ||
@@ -45,0 +42,0 @@ } |
@@ -517,3 +517,3 @@ var config = require(__dirname+'/config.js'); | ||
It('`union` should work', function* (done) { | ||
It('`union` should work - 1', function* (done) { | ||
try{ | ||
@@ -529,15 +529,25 @@ result = yield r.expr([0, 1, 2]).union([3, 4, 5]).run(); | ||
}) | ||
It('`union` should throw if no argument has been passed', function* (done) { | ||
try { | ||
result = yield r.db(dbName).table(tableName).union().run(); | ||
It('`union` should work - 2', function* (done) { | ||
try{ | ||
result = yield r.union([0, 1, 2], [3, 4, 5], [6, 7]).run(); | ||
assert.deepEqual(result, [0, 1, 2, 3, 4, 5, 6, 7]); | ||
done() | ||
} | ||
catch(e) { | ||
if (e.message.match(/^`union` takes 1 argument, 0 provided after/) ){ | ||
done() | ||
} | ||
else { | ||
done(e); | ||
} | ||
done(e); | ||
} | ||
}) | ||
It('`union` should work - 3', function* (done) { | ||
try{ | ||
result = yield r.union().run(); | ||
assert.deepEqual(result, []); | ||
done() | ||
} | ||
catch(e) { | ||
done(e); | ||
} | ||
}) | ||
It('`sample` should work', function* (done) { | ||
@@ -544,0 +554,0 @@ try{ |
@@ -15,3 +15,3 @@ var Promise = require('bluebird'); | ||
//query = 'r.table("foo").add(1).add(1).add("hello-super-long-string").add("another-long-string").add("one-last-string").map( function(doc) { return r.expr([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]).map(function(test) { return test("b").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").mul(test("b")).merge({ firstName: "xxxxxx", lastName: "yyyy", email: "xxxxx@yyyy.com", phone: "xxx-xxx-xxxx" }); }).add(2).map(function(doc) { return doc.add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string") }); })'; | ||
query = 'r.ceil()'; | ||
query = 'r.db(dbName).table(tableName).map(function(doc) { return doc("key").add(undefined)})'; | ||
Promise.coroutine(function* () { | ||
@@ -18,0 +18,0 @@ try { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
820070
73
24844
167
26