Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/833#discussion_r100531532
  
    --- Diff: app/addons/verifyinstall/resources.js ---
    @@ -11,152 +11,159 @@
     // the License.
     
     import app from "../../app";
    +import { json } from "../../core/http";
     import FauxtonAPI from "../../core/api";
     import Databases from "../databases/resources";
     import Documents from "../documents/resources";
     var Verifyinstall = FauxtonAPI.addon();
     
     var db = new Databases.Model({
    -  id: 'verifytestdb',
    -  name: 'verifytestdb'
    +  id: "verifytestdb",
    +  name: "verifytestdb"
     });
     
     var dbReplicate = new Databases.Model({
    -  id: 'verifytestdb_replicate',
    -  name: 'verifytestdb_replicate'
    +  id: "verifytestdb_replicate",
    +  name: "verifytestdb_replicate"
     });
     
     var doc, viewDoc;
     
     Verifyinstall.testProcess = {
    -  saveDoc: function () {
    -    doc = new Documents.Doc({_id: 'test_doc_1', a: 1}, {
    +  saveDoc: function() {
    +    doc = new Documents.Doc({ _id: "test_doc_1", a: 1 }, {
           database: db
         });
     
         return doc.save();
       },
    -
    -  destroyDoc: function () {
    +  destroyDoc: function() {
         return doc.destroy();
       },
    -
    -  updateDoc: function () {
    -    doc.set({b: 'hello'});
    +  updateDoc: function() {
    +    doc.set({ b: "hello" });
         return doc.save();
       },
    -
    -  saveDB: function () {
    +  saveDB: function() {
         return db.save();
       },
    -
    -  setupDB: function (db) {
    +  setupDB: function(db) {
         var deferred = FauxtonAPI.Deferred();
    -    db.fetch()
    -    .then(function () {
    -      return db.destroy();
    -    }, function () {
    -      deferred.resolve();
    -    })
    -    .then(function () {
    -      deferred.resolve();
    -    }, function (xhr, error, reason) {
    -      if (reason === 'Unauthorized') {
    -        deferred.reject(xhr, error, reason);
    -      }
    -    });
    +    db
    +      .fetch()
    +      .then(
    +        function() {
    +          return db.destroy();
    +        },
    +        function() {
    +          deferred.resolve();
    +        }
    +      )
    +      .then(
    +        function() {
    +          deferred.resolve();
    +        },
    +        function(xhr, error, reason) {
    +          if (reason === "Unauthorized") {
    +            deferred.reject(xhr, error, reason);
    +          }
    +        }
    +      );
     
         return deferred;
       },
    -
    -  setup: function () {
    -    return FauxtonAPI.when([
    -      this.setupDB(db),
    -      this.setupDB(dbReplicate)
    -    ]);
    +  setup: function() {
    +    return FauxtonAPI.when([this.setupDB(db), this.setupDB(dbReplicate)]);
       },
    -
    -  testView: function () {
    -    var deferred = FauxtonAPI.Deferred();
    -    var promise = $.get(viewDoc.url() + '/_view/testview');
    -
    -    promise.then(function (resp) {
    -      resp = _.isString(resp) ? JSON.parse(resp) : resp;
    -      var row = resp.rows[0];
    -      if (row.value === 6) {
    -        return deferred.resolve();
    -      }
    -      var reason = {
    -        reason: 'Values expect 6, got ' + row.value
    -      };
    -
    -      deferred.reject({responseText: JSON.stringify(reason)});
    -    }, deferred.reject);
    -
    -    return deferred;
    +  testView: function() {
    +    return json(viewDoc.url() + "/_view/testview").then(
    +      function(resp) {
    +        var row = resp.rows[0];
    +        if (row.value === 6) {
    +          return Promise.resolve();
    +        }
    +        var reason = {
    +          reason: "Values expect 6, got " + row.value
    +        };
    +        return Promise.reject({ responseText: JSON.stringify(reason) });
    +      },
    +      Promise.reject
    +    );
       },
    +  setupView: function() {
    +    var doc1 = new Documents.Doc({ _id: "test_doc_10", a: 1 }, {
    +      database: db
    +    });
    +    var doc2 = new Documents.Doc({ _id: "test_doc_20", a: 2 }, {
    +      database: db
    +    });
    +    var doc3 = new Documents.Doc({ _id: "test_doc_30", a: 3 }, {
    +      database: db
    +    });
     
    -  setupView: function () {
    -    var doc1 = new Documents.Doc({_id: 'test_doc_10', a: 1}, { database: 
db });
    -    var doc2 = new Documents.Doc({_id: 'test_doc_20', a: 2}, { database: 
db });
    -    var doc3 = new Documents.Doc({_id: 'test_doc_30', a: 3}, { database: 
db });
    -
    -    viewDoc = new Documents.Doc({
    -      _id: '_design/view_check',
    -      views: {
    -        'testview': {
    -          map: 'function (doc) { emit(doc._id, doc.a); }',
    -          reduce: '_sum'
    +    viewDoc = new Documents.Doc(
    +      {
    +        _id: "_design/view_check",
    +        views: {
    +          testview: {
    +            map: "function (doc) { emit(doc._id, doc.a); }",
    +            reduce: "_sum"
    +          }
             }
    +      },
    +      {
    +        database: db
           }
    -    }, {
    -      database: db
    -    });
    +    );
     
    -    return FauxtonAPI.when([doc1.save(), doc2.save(), doc3.save(), 
viewDoc.save()]);
    +    return FauxtonAPI.when([
    +      doc1.save(),
    +      doc2.save(),
    +      doc3.save(),
    +      viewDoc.save()
    +    ]);
       },
    -
    -  setupReplicate: function () {
    +  setupReplicate: function() {
         return $.ajax({
    -      url: app.host + '/_replicate',
    -      contentType: 'application/json',
    -      type: 'POST',
    -      dataType: 'json',
    +      url: app.host + "/_replicate",
    +      contentType: "application/json",
    +      type: "POST",
    +      dataType: "json",
           processData: false,
           data: JSON.stringify({
             create_target: true,
    -        source: 'verifytestdb',
    -        target: 'verifytestdb_replicate'
    +        source: "verifytestdb",
    +        target: "verifytestdb_replicate"
           })
         });
       },
    -
    -  testReplicate: function () {
    +  testReplicate: function() {
    --- End diff --
    
    These changes don't really seem related to your PR. It just makes it a 
little harder to review everything


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to