summaryrefslogtreecommitdiff
path: root/share/www/script/test/design_docs.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-09-27 20:06:22 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-09-27 20:06:22 +0000
commit7665e449cdfff1e660ed2bbac3de4507cb063a18 (patch)
treea3c7994475d955fce448af9a8c60c202c0e92f6e /share/www/script/test/design_docs.js
parent6c6db011c2064597526c6f36878a282238dd2bf2 (diff)
CommonJS support in map functions
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001895 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/design_docs.js')
-rw-r--r--share/www/script/test/design_docs.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/share/www/script/test/design_docs.js b/share/www/script/test/design_docs.js
index 8864225c..62606341 100644
--- a/share/www/script/test/design_docs.js
+++ b/share/www/script/test/design_docs.js
@@ -54,7 +54,18 @@ function() {
summate2: {map:"function (doc) {emit(doc.integer, doc.integer)};",
reduce:"function (keys, values) { return sum(values); };"},
huge_src_and_results: {map: "function(doc) { if (doc._id == \"1\") { emit(\"" + makebigstring(16) + "\", null) }}",
- reduce:"function (keys, values) { return \"" + makebigstring(16) + "\"; };"}
+ reduce:"function (keys, values) { return \"" + makebigstring(16) + "\"; };"},
+ lib : {
+ baz : "exports.baz = 'bam';",
+ foo : {
+ foo : "exports.foo = 'bar';",
+ boom : "exports.boom = 'ok';",
+ zoom : "exports.zoom = 'yeah';"
+ }
+ },
+ commonjs : {
+ map : "function(doc) { emit(null, require('views/lib/foo/boom').boom)}"
+ }
},
shows: {
simple: "function() {return 'ok'};",
@@ -99,10 +110,14 @@ function() {
var vinfo = dinfo.view_index;
TEquals(51, vinfo.disk_size);
TEquals(false, vinfo.compact_running);
- TEquals("3f88e53b303e2342e49a66c538c30679", vinfo.signature);
+ TEquals("dc3264b45b74cc6d94666e3043e07154", vinfo.signature, 'ddoc sig');
db.bulkSave(makeDocs(1, numDocs + 1));
+ // test commonjs in map functions
+ resp = db.view("test/commonjs", {limit:1});
+ T(resp.rows[0].value == 'ok');
+
// test that the _all_docs view returns correctly with keys
var results = db.allDocs({startkey:"_design", endkey:"_design0"});
T(results.rows.length == 1);