0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00
ghost/test/unit/models
Fabien 'egg' O'Carroll 8f660c3259
Improved settings validation (#12048)
closes #12001

* Moved settings validation to the model

This moves the settings validation out of the validation file and into
the model, as it is _only_ used there.

It also sets us up in the future for custom validators on individual
settings.

* Improved validation of stripe_plans setting

- Checks `interval` is a valid string
- Checks `name` & `currency` are strings

* Moved stripe key validation into model

The stripe key settings are all nullable and the regex validation fails
when the input is `null`. Rather than reworking the entirety of how we
validate with default-settings validation objects, this moves the
validation into methods on the Settings model.

* Added tests for new setting validations

Adds tests for both valid and invalid settings, as well as helpers
making future tests easier and less repetitive
2020-07-15 17:11:27 +02:00
..
base Moved core/server/lib/url-utils to core/shared/url-utils (#11856) 2020-05-28 11:57:02 +01:00
plugins Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00
api-key_spec.js
integration_spec.js
invite_spec.js Refactored tests to destructure common lib import (#11838) 2020-05-25 09:49:38 +01:00
member_spec.js
permission_spec.js Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00
post_spec.js Refactored tests to destructure common lib import (#11838) 2020-05-25 09:49:38 +01:00
session_spec.js
settings_spec.js Improved settings validation (#12048) 2020-07-15 17:11:27 +02:00
tag_spec.js
user_spec.js Remove common errors (#11848) 2020-05-26 19:10:29 +01:00