Ghost/test
Kevin Ansfield 256f16a01f
🐛 Fixed URLs not being correctly transformed during insert operations (#13618)
closes https://github.com/TryGhost/Team/issues/1150

Our override of the base Bookshelf `insert` operation so that our own `formatOnWrite()` method is called on attributes was working on a false assumption that an `attrs` attribute is passed in as it is for the `update` operation. Instead Bookshelf's base update uses the `model.attributes` values to create an `attrs` object that is then passed through the usual `.format()` method meaning that our `insert` override was not actually doing anything.

- added a failing regression test for the `formatOnWrite()` override behaviour
- adjusted our insert/update overrides to set an internal `_isWriting` property on the model, then if that property is true our `.format()` override (which is called by Bookshelf on a generated `attrs` object during inserts) we manually call our `.formatOnWrite()` method
  - updated both overrides even though `update` was working for consistency and less cognitive overhead for reasoning between two different approaches
2021-10-20 15:22:46 +01:00
..
e2e-api Fixed failing custom theme settings API tests 2021-10-20 13:31:41 +01:00
e2e-frontend Updated e2e tests to be async/await 2021-10-06 15:51:05 +01:00
e2e-server Removed remaining usage of i18n & translation file 2021-10-15 11:39:07 +01:00
integration Moved URL service to backend 2021-10-19 07:29:09 +13:00
regression 🐛 Fixed URLs not being correctly transformed during insert operations (#13618) 2021-10-20 15:22:46 +01:00
unit Updated Offers related tables (#13609) 2021-10-20 14:22:37 +02:00
utils Colocated mock-express style utilities 2021-10-20 13:18:35 +01:00
.eslintignore Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00
.eslintrc.js Upgraded no-skipped-test rule to error 2021-05-26 14:57:43 +01:00
.jshintrc Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00