0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/test/utils
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
..
fixtures Improved validation layer (#9427) 2018-02-16 00:49:15 +01:00
mocks Improved validation layer (#9427) 2018-02-16 00:49:15 +01:00
api.js 🐛 Fixed showing old release notifications in the about page 2018-01-18 12:19:55 +01:00
assertions.js 🎉 🎨 Remove middleware/index.js (#7548) 2016-10-13 17:24:09 +02:00
channelUtils.js Changed channelsRouter to use new base class 2017-11-09 10:47:20 +00:00
configUtils.js 🔥 remove forceAdminSSL and urlSSL, add admin url (#7937) 2017-02-03 18:13:22 +00:00
index.js 🐛Fixed asset redirects (#9455) 2018-02-14 17:21:31 +01:00