discourse/app
David Taylor 84c2c2f477
DEV: Refactor Site creation in tests (#15707)
Previously, `resetSite()` would immediately generate a new `Site` instance, and run all the initialization logic within the model. This included initializing Category objects.

This was problematic because `resetSite()` is called before any initializers have been run. That means that any modifications to the Site or Category classes would not have any effect on the already-initialized Site/Category instances.

This commit makes two main changes so so that the test environment is more production-like:

1. Update `resetSite` so that it simply stores the new data in the PreloadStore, and destroys the old Site instance. Initialization of a new site instance happens 'just in time' (normally during the `inject-discourse-objects` initializer)

2. Update the `helperContext` in tests to use getters. This avoids the need to look up `Site.current()` before initializers have run

It also makes a minor adjustment to one test which was relying on a side-effect of the previous behavior.

This should resolve the failing tests for discourse-category-expert under Ember-CLI: https://github.com/discourse/discourse-category-experts/pull/69
2022-02-03 10:02:47 +00:00
..
assets DEV: Refactor Site creation in tests (#15707) 2022-02-03 10:02:47 +00:00
controllers FIX: post mover validation color and message (#15688) 2022-02-02 16:22:52 +11:00
helpers DEV: Support for running theme test with Ember CLI (third attempt) 2022-01-13 16:02:07 -05:00
jobs DEV: Fix methods removed in Ruby 3.2 (#15459) 2022-01-05 18:45:08 +01:00
mailers DEV: Hash tokens stored from email_tokens (#14493) 2021-11-25 09:34:39 +02:00
models FIX: Liking whispers should not contribute to Topic#like_count. (#15703) 2022-02-03 16:24:33 +11:00
serializers DEV: Add markdown_additional_options to Site (#15738) 2022-01-28 13:02:02 +10:00
services FIX: Prevent "integer out of range" when merging post timings (#15723) 2022-01-26 23:34:28 +01:00
views DEV: Support for running theme test with Ember CLI (third attempt) 2022-01-13 16:02:07 -05:00