Commit Graph

45 Commits

Author SHA1 Message Date
Agnes Lin de4718d5b8 chore: update copyrights years (#1737) 2019-05-08 11:45:37 -04:00
biniam eff6458a2a test: define models in before hooks
Re-work tests from #1702 based on the failures observed in #1719
and cherry-pick those commits back to master using ES6 syntax.
2019-04-30 11:15:23 -04:00
Miroslav Bajtoš 76673a8ed8
Update `should` to `13.2.3` 2019-04-30 11:44:08 +02:00
biniam 1534392c62 fix: coerce date array properties 2019-04-16 10:50:54 -04:00
Hage Yaapa a391c83a2c feat: Support "type" key in sub-properties 2019-02-21 13:58:34 +05:30
Miroslav Bajtoš fd99c6dc6e
Support nested properties with class type
When converting plain-data object values into model instances,
correctly handle the case where the constructor functions is a class
constructor and must be invoked via `new`.
2019-01-25 10:05:36 +01:00
Miroslav Bajtoš 9e0f624ad5
manually fix remaining problems 2018-12-07 16:46:15 +01:00
Miroslav Bajtoš 422ec9ad4f
autofix eslint errors 2018-12-07 16:46:15 +01:00
Miroslav Bajtoš 7d50f6130b
Upgrade eslint-config-loopback + fix formatting
The new version of our config enabled function-paren-newline rule,
this commit fixes the codebase to use more consistent handling
of newlines when calling functions.
2018-07-16 08:46:25 +02:00
Miroslav Bajtoš d2ee73b9d3
Update eslint + config to latest 2018-06-12 09:13:32 +02:00
Janny e85e0f600b Fix basic-querying (#1509)
* Fix basic-querying

* Fix duplicate MyModel
2017-10-16 16:07:01 -04:00
Zak Barbuto 99cea38fd0 Allow passing null to base model ctor 2017-09-28 09:42:30 +09:30
loay b1b2d5df0c Catch errors using cb 2017-07-24 14:08:58 -04:00
Janny b9129e6973 Run juggler tests for Cloudant (#1414) 2017-07-11 14:56:39 -04:00
Kevin Delisle 8e97385a8f datatype.test: use predefined date
Some databases are storing the value in UTC (not ISO) format,
and truncating the values. Even though this is technically
unavoidable, it does fail strict string equality.
2017-04-28 15:40:19 -04:00
Diana Lau a488a71dbd replace exception thrown for invalid dates 2017-04-21 15:57:11 -04:00
Tetsuo Seto ead1fb2965 Add test support for Cassandra connector 2017-04-07 11:10:47 -07:00
Siddhi Pai 3baa61590e Fix block padding
* Remove test/.eslintrc
* run eslint . --fix
2016-12-13 16:05:50 -08:00
Miroslav Bajtoš 0f7a567f18 Upgrade eslint & config to latest
- eslint ^3.11.1
 - eslint-config-loopback: ^6.0.0
 - fix linter errors (mostly no-undef)
2016-12-05 15:14:09 +01:00
David Cheung 805db78e19 Strict mode now always return validationError
- Deprecation of strict:validate and strict:throw
- When strict mode is enabled, it will now always
return validation error (previous strict:validate)
2016-09-19 10:27:24 -04:00
Amir Jafarian aec678d252 Fix manually 2016-08-22 19:20:12 -04:00
Amir Jafarian aa6d28268b Auto-update by eslint --fix 2016-08-22 15:12:25 -04:00
Supasate Choochaisri 94c5c18541 Add test to catch invalid date property
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-07-14 17:27:02 +07:00
Miroslav Bajtoš 39e04a1756 eslint --fix 2016-04-05 15:25:34 +02:00
Ryan Graham c467b43c38 Insert copyright headers 2016-04-04 18:14:03 -07:00
Simon Ho 5d453b5038 Revert "Correct syntax for should and more"
This reverts commit 62de2ed69e.
2015-12-23 15:41:16 -08:00
Amir Jafarian 62de2ed69e Correct syntax for should and more
This fixes lots of failures in connectors
2015-12-16 16:24:48 -05:00
Raymond Feng 682f6340d3 Optimze automigrate() to cut the test time signicantly 2015-08-27 15:59:58 -07:00
Raymond Feng 5ef444e45d Conditionally pass options to connector CRUD methods 2015-05-13 09:36:45 -07:00
Miroslav Bajtoš 40eecd98c9 validations: treat `NaN` as a blank value
When a required number property is set to NaN, for example as a result
of coersion (`Number([1,2,3])`), the "presence" validation now correctly
reports an error.
2015-04-22 19:57:48 +02:00
Miroslav Bajtoš b66d9fbc54 Fix persistUndefinedAsNull tests w/ SQL connectors
Check whether the connector enables strict mode and don't assert on
dynamic properties in such case.
2015-03-30 10:45:55 +02:00
Miroslav Bajtoš 9fd4c00225 Add model setting "persistUndefinedAsNull"
When the setting "persistUndefinedAsNull" is true,
the model will use `null` instead of `undefined` in
all property values.

 - Known optional model properties are set to `null` when no value
   was provided.

 - When setting model properties, `undefined` is always converted
   to `null`. This applies to both known (model-defined) properties
   and additional (custom, dynamic) properties.

 - The instance method `toObject()` converts `undefined` to `null` too.
   Because `toJSON()` calls `toObject()` under the hood, the change
   applies to `toJSON()` too.
2015-03-27 18:25:26 +01:00
Raymond Feng 04348a1168 Make sure id properties cannot be changed 2015-03-16 09:25:38 -07:00
Pradnya Baviskar be37fb4388 Return 400 when client provides an incorrect value 2015-02-05 16:58:42 +05:30
Miroslav Bajtoš 3593127ef3 Update to `should` to the latest version 4.6.3 2015-02-03 11:44:15 +01:00
Fabien Franzen a24b222a72 Don't coerce nested objects into Model instances
For queries, this is undesirable. It also affects
loopback-connector-mongodb's ability to perform nested queries (it
expects plain objects to work correctly, and to allow $elemMatch for
example).
2015-01-08 15:34:04 +01:00
Raymond Feng 510f5ef6ac Check the Array type
See https://github.com/strongloop/loopback-connector-mongodb/issues/21
2014-03-03 15:52:49 -08:00
Raymond Feng 0d3ce00f35 Simplify the test case 2014-02-12 22:49:54 -08:00
arlaneenalra 99dff35de2 Add unit test for datatype handling in updateAttributes. 2014-02-07 06:50:35 -06:00
Raymond Feng 2b8c1ebaee Reformat the code 2014-01-24 09:09:53 -08:00
Ritchie Martori dbd5efed50 Revert adapter serialization. Remove geo point distance indicator. 2013-07-01 13:16:51 -07:00
Ritchie Martori 008b406dd7 model.find => model.findById, model.all => model.find 2013-06-24 12:42:58 -07:00
Anatoliy Chakkaev c4d4b68413 Datatypes casting 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 43f395d653 Manually require init 2013-04-06 14:57:12 +04:00
Anatoliy Chakkaev 9fc4e5e887 Added datatypes tests 2013-04-06 14:34:16 +04:00