Ghost/test/regression
Kevin Ansfield 426cbeec0f
🐛 Fixed performance regression introduced in 4.1.0 (#12807)
closes https://github.com/TryGhost/Ghost/issues/12791
closes https://github.com/TryGhost/Team/issues/566

https://github.com/TryGhost/Ghost/pull/12787 introduced a significant performance regression due to a misunderstanding of when Bookshelf calls `.format()` ([related upstream issue](https://github.com/bookshelf/bookshelf/issues/668)). We expected `.format()` to only be called on save but it's also called when Bookshelf performs fetching and eager loading which happens frequently. `.format()` can be a heavy method as it needs to parse and serialize html and markdown so it should be performed as infrequently as possible.

- override `sync()` in the base model so we can call our own `.formatOnWrite()` method to transform attributes on `update` and `insert` operations
  - this was the only feasible location in Bookshelf I could find that is low enough level to not require modifying model instance attributes
  - gives models the option to perform heavy transform operations only when writing to the database compared to the usual `.format()` method that is also called on fetch in many situations
2021-03-23 09:11:24 +00:00
..
api Fixed broken tests from previous commit 2021-03-17 16:18:48 +01:00
exporter Added latest export body generator 2021-03-23 00:42:22 +13:00
importer Renamed importer spec to match tested version 2021-03-23 00:42:22 +13:00
migrations Updated fixtures for Ghost v4.0 2021-03-10 17:37:16 +00:00
models 🐛 Fixed performance regression introduced in 4.1.0 (#12807) 2021-03-23 09:11:24 +00:00
settings Added routes_hash setting (#12171) 2020-09-07 21:54:55 +12:00
site Hardened frontend tests checking API engine 2021-02-24 18:55:12 +13:00
update-check Fixed linting error 2021-01-14 18:39:27 +13:00
README.md Updated acceptance&regression test suite readmes 2021-01-22 16:42:02 +13:00

Regression Tests

These tests should ensure that we don't break Ghost for all available APIs.

The goal is that most of these packages use Ghost's API's to test behaviours, otherwise transform the tests into unit tests.