loopback-datasource-juggler/test
Partap Davis 1e6c453191 Add Promises to DAO
When a callback is omitted from a DAO method, return a Promise that
resolves to the value normally passed to the callback of that method.
If a callback is provided, behave normally.

This API will use native ES6 promises if available.  If not available,
or to force the use of another Promise library, you must assign the
global.Promise object.

e.g.:
global.Promise = require('bluebird')

Class methods affected:

- create
- updateOrCreate / upsert
- findOrCreate
- exists
- find
- findOne
- findById
- findByIds
- remove / deleteAll / destroyAll
- removeById / deleteById / destroyById
- count
- update / updateAll

Prototype methods affected:

- save
- delete / remove / destroy
- updateAttribute
- updateAttributes
- reload

Exceptions / edge cases:

- create() used to return the data object that was passed in, even if
  no callback was provided.  Now, if a callback is provided, it will
  return the data object, otherwise it will return a Promise.

- If create() is provided an array of data objects for creation, it
  will continue to always return the array. This batch creation mode
  does not support promises.

- findOrCreate() has a callback of the form: cb(err, instance, created),
  with the extra parameter indicating whether the instance was created
  or not. When called with its promise variant, the resolver will
  receive a single array parameter: [instance, created]
2015-02-26 13:45:37 -07:00
..
CustomTypeForeignKey.test.js testcase for #420 2015-02-05 10:12:34 +03:00
async-observer.test.js ModelBaseClass: promise mode for notifyObserversOf 2015-02-17 18:19:21 +01:00
basic-querying.test.js test for updateAll 2015-02-24 13:56:57 +02:00
common.batch.js test: undefined property values are preserved 2015-02-04 09:08:28 +01:00
common_test.js add a flag to callback of findOrCreate to indicate find or create 2014-12-25 22:19:15 +08:00
crud-with-options.test.js Fix `deleteById(id)` and other test failures 2015-02-13 09:34:40 -08:00
datatype.test.js Return 400 when client provides an incorrect value 2015-02-05 16:58:42 +05:30
default-scope.test.js fix default include in default scope fails findById 2014-12-11 15:14:35 +08:00
defaults.test.js Update to `should` to the latest version 4.6.3 2015-02-03 11:44:15 +01:00
events.js Fix `deleteById(id)` and other test failures 2015-02-13 09:34:40 -08:00
geo.test.js Fix the floating number comparison 2015-01-05 10:53:26 -08:00
hooks.test.js Intent-based hooks for persistence 2015-01-29 08:43:52 +01:00
include.test.js Change equal to eql to support mongodb ObjectID 2015-02-08 11:14:51 -08:00
init.js ModelBaseClass: promise mode for notifyObserversOf 2015-02-17 18:19:21 +01:00
introspection.test.js Tidy up model building from data sources 2014-09-12 14:25:35 -07:00
json.test.js Reformat the code 2014-01-24 09:09:53 -08:00
loopback-data.test.js Reformat the code 2014-01-24 09:09:53 -08:00
loopback-dl.test.js Make sure base properties/settings are merged into the submodel 2015-02-07 11:15:28 -08:00
manipulation.test.js Add Promises to DAO 2015-02-26 13:45:37 -07:00
memory.test.js support optimized findOrCreate 2015-02-07 10:23:04 +08:00
mixins.test.js Add ability to apply a plugin multiple times from LDL 2014-08-17 12:29:04 +02:00
model-definition.test.js Merge pull request #400 from chrene/protected 2015-02-02 09:04:51 -08:00
performance.coffee Reformat the code 2014-01-24 09:09:53 -08:00
persistence-hooks.suite.js Tidy up tests so that they will work with RDBs 2015-02-20 16:10:25 -08:00
relations.test.js Add err checks 2015-02-20 21:14:48 -08:00
schema.test.js Remove workaround for perfomance degradation 2015-02-10 13:28:47 +03:00
scope.test.js Add hint, minor cleanup 2014-08-30 21:08:23 +02:00
spec_helper.js Reformat the code 2014-01-24 09:09:53 -08:00
test1-schemas.json Reformat the code 2014-01-24 09:09:53 -08:00
test2-schemas.json Reformat the code 2014-01-24 09:09:53 -08:00
transient.test.js Remove legacy Schema references 2014-09-04 18:01:04 +02:00
util.test.js Add strict flag to sortObjectsByIds 2014-08-15 19:47:12 +02:00
validations.test.js Fixed nullCheck in validations to correct behavior when dealing with undefined attributes 2015-01-27 22:18:47 +00:00