Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover manipulation.test.js #159

Merged
merged 4 commits into from
Jul 19, 2017
Merged

Recover manipulation.test.js #159

merged 4 commits into from
Jul 19, 2017

Conversation

jannyHou
Copy link
Contributor

@jannyHou jannyHou commented Jul 14, 2017

@jannyHou jannyHou changed the title Recover manipulation.test.js [WIP]Recover manipulation.test.js Jul 14, 2017
Fixes the failing upsertWithWhere & prototype.delete Test Cases
package.json Outdated
@@ -33,7 +33,7 @@
"dockerode": "^2.4.3",
"eslint": "^2.13.1",
"eslint-config-loopback": "^4.0.0",
"loopback-datasource-juggler": "^3.0.0",
"loopback-datasource-juggler": "git://github.com/strongloop/loopback-datasource-juggler.git#cloudant/crud-test",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure I don't forget to change it back

@jannyHou jannyHou changed the title [WIP]Recover manipulation.test.js Recover manipulation.test.js Jul 18, 2017
@@ -173,6 +173,13 @@ Cloudant.prototype._insert = function(model, data, cb) {
return cb(err);
}
data[idName] = result.id;

// Convert ID to Number if Model defines ID as type Number
Copy link
Contributor Author

@jannyHou jannyHou Jul 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -368,7 +377,7 @@ Cloudant.prototype.destroy = function destroy(model, id, options, cb) {
cb(err, result && result.ok ? {count: 1} : {count: 0});
});
} else {
cb(new Error('could not find matching item in database!'));
return cb(null, {count: 0});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loopback connectors doesn't return error if item not found in database. It just return the count and juggler return error according to the flag strictDelete and the count, see:
https://github.com/strongloop/loopback-datasource-juggler/blob/3a10c77cbdeb658ffc34e8db95acc7c57f2010c0/lib/dao.js#L2819

Related test cases: https://github.com/strongloop/loopback-datasource-juggler/blob/3a10c77cbdeb658ffc34e8db95acc7c57f2010c0/test/manipulation.test.js#L1837-L1880

@@ -17,4 +17,5 @@ describe('cloudant imported features', function() {
require('loopback-datasource-juggler/test/hooks.test.js');
require('loopback-datasource-juggler/test/relations.test.js');
require('loopback-datasource-juggler/test/include.test.js');
require('loopback-datasource-juggler/test/manipulation.test.js');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above is same as require common.batch.test.js and include.test.js(couchdb2 uses those two instead of listing them all), just since it's extending everything from couchdb2 soon....

@ssh24
Copy link
Contributor

ssh24 commented Jul 18, 2017

@slnode test please

@jannyHou jannyHou merged commit 819d49e into master Jul 19, 2017
@jannyHou jannyHou removed the #review label Jul 19, 2017
@jannyHou jannyHou deleted the 2.xRelease branch August 2, 2017 19:56
kjdelisle pushed a commit that referenced this pull request Aug 22, 2017
 * Inherit couchdb functionalities (#163) (Sakib Hasan)
 * Add stalebot configuration (Kevin Delisle)
 * Recover & reuse couchdb2 tests (jannyHou)
 * Fix readme (ssh24)
 * Create Issue and PR Templates (#171) (Sakib Hasan)
 * Add CODEOWNER file (Diana Lau)
 * Recover manipulation.test.js (#159) (Janny)
 * Recover juggler tests (#158) (Janny)
 * Require init on mocha args (ssh24)
 * Do not strip _rev value on create (ssh24)
 * Fix docs on bulk replace op hooks (ssh24)
 * Fix update/updateAll function (ssh24)
 * Add cloudant specific bulkReplace function (ssh24)
 * Check error and result (#149) (Janny)
 * Fix updateAttributes function (ssh24)
 * Fix doc (#148) (Janny)
 * viewDocs (#133) (Janny)
 * Return back result count in updateAll (ssh24)
 * Fix database name typo on README (ssh24)
 * Add regexp doc (#143) (Janny)
 * Add proxy config test (#142) (Janny)
 * Allow users to spawn docker and run tests (ssh24)
 * test: use Cloudant 2.x based image for testing (Ryan Graham)
 * test: replace setup.sh with test.js (Ryan Graham)
 * Refactor functions in cloudant (ssh24)
 * Allow handling of ._rev on models (#123) (Kevin Delisle)
 * Allow travis to run against the latest code base (#138) (Sakib Hasan)
 * Add docker setup (#132) (Sakib Hasan)
 * Fix updateOrCreate (#136) (Sakib Hasan)
 * Fix typo (#135) (Janny)
 * cloudant.test: cleanup after test runs (Kevin Delisle)
 * Setup Travis with Docker Compose (Kevin Delisle)
 * Refactor doc (#116) (Janny)
 * reinstate bulk update (biniam)
 * add array prop update tests (biniam)
 * update docs with current revision (biniam)
 * Allow id property to be a number (#115) (Sakib Hasan)
 * autoupdate and automigrate fix (#109) (Janny)
 * update readme to doc async connect (biniam)
 * check cloudant db in config (biniam)
 * call driver asynchronously (biniam)
 * Fix sort query builder (#107) (Janny)
 * Recover maxrows.test.js (#91) (Janny)
 * Fix regexp.test.js (#103) (Janny)
 * Use define function in loopback-connector (jannyHou)
 * add url config example (biniam)
 * Update connector to 4.0.0 (ssh24)
 * Add doc for fitler and order (jannyHou)
 * Add advisory note regarding update (ssh24)
 * Add $elemMatch for array (jannyHou)
 * Revert "Build selector with array type data" (jannyHou)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants