millayr commented on a change in pull request #911: Handle view creation on
empty ddoc
URL: https://github.com/apache/couchdb-fauxton/pull/911#discussion_r114756963
##########
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:
done!
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services