Commit Graph

62 Commits

Author SHA1 Message Date
Loay 06cb481c3f Update eslint to loopback config v5
Notable side-effects:
 - loopback no longer exports "caller" and "arguments" properties
 - kv-memory connector is now properly added to the connector registry
 - the file "test/support.js" was finally removed
2016-11-22 14:08:02 +01:00
David Cheung b3c43b60cd make test individually runable
previously when you do something like mocha test/model.test.js
you would get an error like "assert is not a function"
2016-11-17 18:05:58 -05:00
David Cheung 5252fba376 allow batch create for persisted models
In strong-remoting 3.x, we have stricken the coercion of inputs
methods that are expecting an Object will nolonger accept an array
as input, to preserve backwards compatibility we have added flag
allowArray in remote arguments, which would accept an array of objects
2016-10-25 15:45:00 -04:00
Tim van der Staaij c58bff6c3d Fix support for remote hooks returning a Promise
Fix beforeRemote/afterRemote to correctly return promises returned
by the user-provided hook callback.
2016-10-05 10:32:44 +02:00
Richard Pringle 0ab33a82d4 Call new disable remote method from model class. 2016-09-21 14:09:24 -04:00
Sonali Samantaray aef6dca30c Expose upsertWithWhere method 2016-09-02 18:10:47 +05:30
Miroslav Bajtoš 98816217c9 test: use local registry in test fixtures
Use local registry in test fixtures to prevent collision in globally
shared models.

Fix issues discoverd in auth implementation where the global registry
was used instead of the correct local one.
2016-07-27 10:07:49 +02:00
Amir Jafarian 6502309e34 Expose `Replace*` methods
*Re-mapping `updateAttributes` endpoint to use
`PATCH` and `PUT`(configurable) verb
*Exposing `replaceById` and `replaceOrCreate` via
`POST` and `PUT`(configurable) verb
2016-06-10 14:56:44 -04:00
David Cheung ddb5327e64 Update tests for strong-error-handler
Fix rest-adapter related test case switching to strong-error-handler
Only affect the test-cases calling rest methods
2016-06-07 13:26:18 -04:00
Supasate Choochaisri 04e26fae5c Separate error-checking and next/done logic from other logic in the test suite
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-05-05 11:12:48 +07:00
Ryan Graham 6964914bab
update copyright statements 2016-05-03 15:50:21 -07:00
Supasate Choochaisri 0ca24389b2 Add new feature to emit a `remoteMethodDisabled` event when disabling a remote method.
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-04-28 09:03:54 +07:00
Miroslav Bajtoš f9702b0ace Use eslint with loopback config
Drop jshint and jscs in favour of eslint.

Fix style violations.

While we are at this, reduce the max line length from 150 to 100.
2016-04-06 10:45:30 +02:00
Ritchie Martori 40c5707a36 Add PersistedModel.createChangeStream() 2015-07-09 13:34:01 -07:00
Miroslav Bajtoš b6b76d538c Fix regression in Model.getApp()
This patch fixes the method Model.getApp() that started to report
the following error after b61fae5 was landed:

assert.js:88
  throw new assert.AssertionError({
        ^
AssertionError: undefined == true
    at loopback/loopback/lib/model.js:392:7
    at EventEmitter.<anonymous> (loopback/loopback/lib/model.js:222:9)
    at EventEmitter.g (events.js:257:16)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:166:7)
    at EventEmitter.app.model (loopback/loopback/lib/application.js:157:9)
2015-04-28 12:49:57 +02:00
Raymond Feng 2bf69a1171 Expose the `filter` argument for findById 2015-04-16 15:02:41 -07:00
Miroslav Bajtoš 699bc7aa97 test: remove global autoAttach 2015-04-07 15:25:18 +02:00
Miroslav Bajtoš dd83be99f0 Implement ModelCtor.afterRemoteError 2015-04-03 10:31:03 +02:00
Miroslav Bajtoš f21b29e34a test: setup GUID for all models tracking changes
Fix all test models that are tracking changes so that they have
a generated unique string id.

Make model names unique where possible to prevent tests reusing
the same model which causes unintented side effects.
2015-03-02 18:16:18 +01:00
Ron Edgecomb a028d9d198 Add error code property to known error responses.
Enhance the error objects with a `code` property containing
a machine-readable string code describing the error, for example
INVALID_TOKEN or USER_NOT_FOUND.

Also improve 404 error messages to include the model name.
2015-01-21 19:04:47 +01:00
Rob Halff 36e1f6840c fix jscs errors 2014-11-21 03:35:36 +01:00
Rob Halff 918497c365 singlequote, semicolon & /*jshint -W030 */ 2014-11-21 02:46:21 +01:00
Miroslav Bajtoš 06b65ccf7e PersistedModel: add remote method aliases
Ensure all loopback 1.x method names are available in loopback 2.x too.
2014-09-10 17:35:02 +01:00
Miroslav Bajtoš eb5ef04b6a Remove `loopback.compat.usePluralNamesForRemoting`
The `usePluralNamesForRemoting` was added in January 2014 for users
upgrading from LoopBack 1.5 or older.
2014-07-21 16:56:46 +02:00
Miroslav Bajtoš ea5b9d16fc Rename DataModel to PersistedModel 2014-06-05 09:56:00 +02:00
Miroslav Bajtoš 26874fc715 Make app.get/app.set available in browser
Implement settings object and methods in browser-express.

Add test/app.test.js to unit-tests run by karma.
2014-06-03 21:32:27 +02:00
Ritchie Martori eec7bdd5f4 - Use the RemoteObjects class to find remote objects instead of
creating a cache
 - Use the SharedClass class to build the remote connector
 - Change default base model from Model to DataModel
 - Fix DataModel errors not logging correct method names
 - Use the strong-remoting 1.4 resolver API to resolve dynamic remote
methods (relation api)
 - Remove use of fn object for storing remoting meta data
2014-05-19 15:56:26 -07:00
Ritchie Martori 2f21f4ec1e Rework replication test 2014-05-15 17:30:58 -07:00
Ritchie Martori 5bf1f76762 !fixup Test cleanup 2014-05-07 07:44:00 -07:00
Ritchie Martori a3a6828709 Move replication implementation to DataModel 2014-05-06 13:31:23 -07:00
Ritchie Martori f8b5fa11ec All tests passing 2014-05-02 21:19:14 -07:00
Ritchie Martori e026a7f52c fixup! unskip failing tests 2014-05-02 20:07:59 -07:00
Ritchie Martori 012f880078 !fixup RemoteConnector tests 2014-05-02 20:04:06 -07:00
Ritchie Martori 1c7527ae3d Add missing test/model file 2014-05-02 18:12:50 -07:00
Ritchie Martori 918596f035 Refactor DataModel remoting
- Move DataModel remoting setup into setup phase
 - Add a remoting type converter for DataModels
 - Move model tests into re-usable test utilities
 - Move other test utilities into new test utilities folder
2014-05-02 18:12:24 -07:00
Ritchie Martori e35309ba27 Fixes for e2e replication / remote connector tests 2014-04-29 17:17:49 -07:00
Ritchie Martori e86a00de69 Merge branch master 2014-04-15 12:53:00 -07:00
Ritchie Martori c521b3c386 Allow app.model() to accept a DataSource instance 2014-03-21 12:18:00 -07:00
Ritchie Martori e7f64a3abf Add karma for running browser tests 2014-02-12 10:17:02 -08:00
Raymond Feng 592f3f9278 Make sure the configured ACL submodel is used 2014-02-03 16:00:01 -08:00
Ritchie Martori a0e595dce8 Add model tests 2014-01-28 14:46:16 -08:00
Miroslav Bajtoš 20766e251a Add loopback.compat to simplify upgrade to 1.6
Add a compatibility layer that allows applications based on LB pre-v1.6
to work with 1.6 versions with a minimum amount of changes required.

New flag(s):
  compat.usePluralNamesForRemoting
2014-01-27 10:29:57 +01:00
Ritchie Martori 216fee3015 Add access type checking 2013-12-06 17:04:47 -08:00
Miroslav Bajtos cf541cb828 Add test for findById returning 404
The test verifies the remoting configuration of
loopback-datasource-juggler, ensuring that
`DataAccessObject.findById()` has `rest.before` handler
correctly set up.
2013-11-21 16:23:01 +01:00
Raymond Feng 48a0242711 Define the models/relations for ACL 2013-11-14 21:19:56 -08:00
Raymond Feng 858ec8714d Fix the id and property access 2013-10-04 15:53:02 -07:00
Ritchie 8a7086be5c Add root true to remote methods 2013-07-24 17:21:15 -07:00
Raymond Feng 267f94c542 Add a deleteById test 2013-07-22 10:00:07 -07:00
Ritchie Martori 0b5e0d4252 More cleanup for test/README.md 2013-07-16 13:46:33 -07:00
Ritchie Martori 253d42a8e8 Cleanup test markdown 2013-07-16 13:41:17 -07:00