You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/05/04 12:05:27 UTC

[GitHub] garrensmith commented on a change in pull request #911: Handle view creation on empty ddoc

garrensmith commented on a change in pull request #911: Handle view creation on empty ddoc
URL: https://github.com/apache/couchdb-fauxton/pull/911#discussion_r114756201
 
 

 ##########
 File path: app/addons/documents/index-editor/__tests__/actions.test.js
 ##########
 @@ -109,26 +101,48 @@ describe('Index Editor Actions', function () {
       var spy = sinon.spy(FauxtonAPI, 'navigate');
 
       designDoc.save = function () {
-        var promise = $.Deferred();
-        promise.resolve();
-        return promise;
+        return FauxtonAPI.Promise.resolve();
       };
       designDocs.fetch = function () {
-        var promise = $.Deferred();
-        promise.resolve();
-        return promise;
+        return FauxtonAPI.Promise.resolve();
       };
-      Actions.deleteView({
+      return Actions.deleteView({
         indexName: viewName,
         database: database,
         designDocs: designDocs,
         designDoc: designDoc,
         isOnIndex: true
+      }).then(() => {
+        assert.ok(spy.getCall(0).args[0].match(/_all_docs/));
+        assert.ok(spy.calledOnce);
       });
+    });
 
-      assert.ok(spy.getCall(0).args[0].match(/_all_docs/));
-      assert.ok(spy.calledOnce);
+    it('saves design doc if it has no view section', function () {
+      const ddoc = { _id: designDocId };
+      const ddocModel = new Documents.Doc(ddoc, { database: database });
+
+      ddocModel.setDdocView('testview', '() => {}', '() => {}');
+      assert.deepEqual(ddocModel.get('views'), {
+        testview: {
+          map: '() => {}',
+          reduce: '() => {}'
 
 Review comment:
   Could you add a check that it adds `language: javascript` as well.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services