changeset 67:5e1e88d1c3f5

Slight refactoring of test suite to make them more readable.
author Atul Varma <varmaa@toolness.com>
date Wed, 15 Apr 2009 10:23:37 -0700
parents 71df4d77dbf6
children c6db5e897d6b
files js/tests.js
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/js/tests.js	Wed Apr 15 10:09:14 2009 -0700
+++ b/js/tests.js	Wed Apr 15 10:23:37 2009 -0700
@@ -119,16 +119,14 @@
     self.assertEqual(dict.has('foo'), true);
   },
   _setupTestDb: function(cb) {
+    var documents = this._testDbContents;
     BrowserCouch.get(
       "blarg",
       function(db) {
         db.wipe(
           function() {
             db.put(
-              [{id: "monkey",
-                content: "hello there dude"},
-               {id: "chunky",
-                content: "hello there dogen"}],
+              documents,
               function() {
                 ModuleLoader.require(
                   "JSON",
@@ -141,6 +139,10 @@
       new FakeStorage()
     );
   },
+  _testDbContents: [{id: "monkey",
+                     content: "hello there dude"},
+                    {id: "chunky",
+                     content: "hello there dogen"}],
   _mapWordFrequencies: function(doc, emit) {
     var words = doc.content.split(" ");
     for (var i = 0; i < words.length; i++)