Ghost/core/test/unit
Katharina Irrgang 0aff9f33d9
Improved validation layer (#9427)
refs https://github.com/TryGhost/Ghost/issues/3658

- the `validateSchema` helper was a bit broken
  - if you add a user without email, you will receive a database error
  - but the validation error should catch that email is passed with null
- it was broken, because:
  - A: it called `toJSON` -> this can remove properties from the output (e.g. password)
  - B: we only validated fields, which were part of the JSON data (model.hasOwnProperty)
- we now differentiate between schema validation for update and insert
- fixed one broken import test
  - if you import a post without a status, it should not error
  - it falls back to the default value
- removed user model `onValidate`
  - the user model added a custom implementation of `onValidate`, because of a bug which we experienced (see https://github.com/TryGhost/Ghost/issues/3638)
  - with the refactoring this is no longer required - we only validate fields which have changed when updating resources
  - also, removed extra safe catch when logging in (no longer needed - unit tested)
- add lot's of unit tests to proof the code change
- always call the base class, except you have a good reason
2018-02-16 00:49:15 +01:00
..
adapters Use Promise support which was added in fs-extra 3.x 2017-12-13 20:57:11 +01:00
api Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
apps Moved default-cards app to lib/mobiledoc (#9341) 2017-12-14 14:44:01 +00:00
config fix(config): cleanup absolute path config function (#8641) 2017-07-06 00:04:18 +02:00
controllers Moved labs, auth, permissions, settings, mail, themes to services (#9339) 2017-12-14 03:01:23 +01:00
data Improved validation layer (#9427) 2018-02-16 00:49:15 +01:00
helpers 🐛Fixed {{get}} helper's date comparison (#9454) 2018-02-14 18:33:07 +01:00
lib Added lib.security.password lib 2018-02-15 21:13:04 +01:00
models Improved validation layer (#9427) 2018-02-16 00:49:15 +01:00
public Tidy up unit test files (#9340) 2017-12-14 03:36:50 +01:00
services Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
web Extended ghost version utility (#9278) 2018-01-03 20:20:18 +01:00
filters_spec.js Tidy up unit test files (#9340) 2017-12-14 03:36:50 +01:00