loopback-datasource-juggler/test
Partap Davis 29eb3434c7 Promisify model relation methods
When a callback is omitted from a method on a model relation that
supports promises, return that promise.  This includes all the standard
DAO methods, as well as any user-defined methods that return promises.

e.g.:
mylist.todos.create({name: 'Item 1'}) // returns Promise

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')

Relations affected:

- BelongsTo
- HasOne
- HasMany
- HasManyThrough
- HasAndBelongsToMany
- ReferencesMany
- EmbedsOne

Exceptions:

The EmbedsMany relation has not been promisified, because most of the
methods return synchronous values.

The base relation getter method [e.g.: mylist.todos()] has not been
promisified, due to its default caching behavior.

New Methods:

- getAsync(condition, cb)

A new method "getAsync()" has been added to all relations except
EmbedsMany, which always fetches from the datasource rather than from
the cache.  It takes an optional "where" condition (except for HasOne
and BelongsTo) and an optional callback.  If the callback is omitted,
a Promise is returned.
2015-04-07 11:41:07 +02:00
..
CustomTypeForeignKey.test.js Fix the test case 2015-03-10 21:26:36 -07:00
async-observer.test.js Add abilities to remove and clear observers - Operation Hooks. 2015-03-11 18:08:35 +07:00
basic-querying.test.js Fix the test cases so that they be run with the mssql connector 2015-03-27 14:18:17 -07: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 Fix persistUndefinedAsNull tests w/ SQL connectors 2015-03-30 10:45:55 +02:00
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 Allow submodel to hide base properties 2015-03-03 10:27:22 -08:00
manipulation.test.js Fix the test cases so that they be run with the mssql connector 2015-03-27 14:18:17 -07:00
memory.test.js Allow nesting properties to be queried for memory connector 2015-03-27 16:05:12 -07:00
mixins.test.js fix #429 Multiple Models can't mixin same class 2015-03-11 16:08:50 +08:00
model-definition.test.js Deprecate property names containing a dot 2015-04-02 09:49:04 +02:00
performance.coffee Reformat the code 2014-01-24 09:09:53 -08:00
persistence-hooks.suite.js Fix test for "after save" called on save/CREATE 2015-04-01 18:25:45 +02:00
relations.test.js Promisify model relation methods 2015-04-07 11:41:07 +02:00
schema.test.js Remove workaround for perfomance degradation 2015-02-10 13:28:47 +03:00
scope.test.js Implement scope.updateAll 2015-03-28 21:25:24 +01: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