You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2017/01/11 11:45:56 UTC
[09/15] couchdb-nano git commit: ct: Test for optional body in
db.atomic
ct: Test for optional body in db.atomic
Project: http://git-wip-us.apache.org/repos/asf/couchdb-nano/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-nano/commit/f757cdd6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-nano/tree/f757cdd6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-nano/diff/f757cdd6
Branch: refs/heads/master
Commit: f757cdd6c29d95fc74ae00b00dd74afcc54b6e9c
Parents: 118e209
Author: Chris Taylor <ct...@gmail.com>
Authored: Sat Apr 23 00:52:50 2016 -0400
Committer: Glynn Bird <gl...@gmail.com>
Committed: Wed Oct 26 14:36:16 2016 +0100
----------------------------------------------------------------------
tests/integration/design/atomic.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-nano/blob/f757cdd6/tests/integration/design/atomic.js
----------------------------------------------------------------------
diff --git a/tests/integration/design/atomic.js b/tests/integration/design/atomic.js
index 8fedaf1..f948387 100644
--- a/tests/integration/design/atomic.js
+++ b/tests/integration/design/atomic.js
@@ -26,6 +26,10 @@ it('should be able to insert an atomic design doc', function(assert) {
var body = JSON.parse(req.body);
doc[body.field] = body.value;
return [doc, JSON.stringify(doc)];
+ },
+ addbaz: function (doc, req) {
+ doc.baz = "biz";
+ return [doc, JSON.stringify(doc)];
}
}
}, '_design/update', function(err) {
@@ -51,6 +55,16 @@ it('should be able to insert atomically', function(assert) {
});
});
+it('should be able to update atomically without a body', function (assert) {
+ db.insert({}, 'baz', function (error, doc) {
+ db.atomic('update', 'addbaz', 'baz', function (error, response) {
+ assert.equal(error, null, 'should be able to update');
+ assert.equal(response.baz, 'biz', 'and the new field is present');
+ assert.end();
+ });
+ });
+});
+
it('should be able to update with slashes on the id', function(assert) {
db.insert({'wat': 'wat'}, 'wat/wat', function(error, foo) {
assert.equal(error, null, 'stores `wat`');