Saving more code clean up and removal
This commit is contained in:
@@ -32,7 +32,7 @@ Shared test helpers (`tests/_helpers/`)
|
||||
| `env.ts` | Constants: `testing_event_id`, `testing_account_id`, `mock_site_domain` |
|
||||
| `ae_defaults.ts` | `ae_app_local_data_defaults` — full localStorage seed object with `__version` |
|
||||
| `idb_helpers.ts` | `inject_badge_and_template()` — write badge + template records into IndexedDB |
|
||||
| `minimal_v3_mocks.ts` | `attach_minimal_v3_routes()`, `seed_trusted_session()`, `setup_badge_test_page()` |
|
||||
| `minimal_ae_api_mocks.ts` | `attach_minimal_routes()`, `seed_trusted_session()`, `setup_badge_test_page()` |
|
||||
|
||||
**`setup_badge_test_page(page, event_id)`** is the one-call `beforeEach` for any badge/event print page test. It wires the pageerror listener, all V3 API mocks, and the trusted auth localStorage seed in one call.
|
||||
|
||||
@@ -44,7 +44,7 @@ Writing / modifying tests
|
||||
```ts
|
||||
import { testing_event_id } from './_helpers/env';
|
||||
import { inject_badge_and_template } from './_helpers/idb_helpers'; // only if IDB needed
|
||||
import { setup_badge_test_page } from './_helpers/minimal_v3_mocks';
|
||||
import { setup_badge_test_page } from './_helpers/minimal_ae_api_mocks';
|
||||
|
||||
const event_id = testing_event_id;
|
||||
|
||||
@@ -54,7 +54,7 @@ test.beforeEach(async ({ page }) => {
|
||||
```
|
||||
|
||||
- If you need IDB data (badge, template), use the inject-then-reload pattern (see Hard-Won Lessons below).
|
||||
- Use `page.route('**/v3/**', handler)` to mock backend responses. `attach_minimal_v3_routes` covers the common cases; add inline `page.route()` calls only for test-specific overrides.
|
||||
- Use `page.route('**/v3/**', handler)` to mock backend responses. `attach_minimal_routes` covers the common cases; add inline `page.route()` calls only for test-specific overrides.
|
||||
|
||||
Adding new tests
|
||||
- Create a new file `tests/my_feature.test.ts`.
|
||||
|
||||
Reference in New Issue
Block a user