Files
a8a37a2f54 tests(web): implement new testing strategy phases (#7420)
* tests(web): implement testing strategy phases 1-5

Phase 1 — Extract pure logic from large untested components:
- GlobalPushNotifications: 13 functions → utils.ts (43 tests)
- FirstSteps: calculateProgress → utils.ts (6 tests)
- ReviewStep: 7 functions → utils.ts (27 tests)
- NestedSafesPopover: 7 functions → utils.ts (23 tests)

Phase 2 — Unified mock infrastructure:
- createTestServer() factory in config/test/msw/testServer.ts
- renderWithScenario() utility in scenario-utils.tsx
- Bridges Jest and Storybook mock ecosystems (9 tests)

Phase 3 — API contract tests:
- Fixture-schema validation with ajv against OpenAPI schema (22 tests)
- Auto-generated types sync check with hash-based script (1 test)

Phase 4 — Component test coverage:
- TxNonce component tests (18 tests)
- FirstSteps component tests (15 tests)
- AssetsTable component tests (8 tests)

Phase 5 — Feature flag matrix tests:
- 15 features verified for disabled/loading/enabled states (77 tests)

Total: ~141 new tests, 0 regressions, 0 type errors.

* tests(web): remove unused imports in TxNonce test

* tests(web): address PR review comments

- Fix typo: _shouldUnregsiterSelectedSafes → _shouldUnregisterSelectedSafes
- Improve convertNullable type safety with destructuring
- Clarify MSW first-match behavior in testServer comment
- Document _resetFeatureRegistry cleanup rationale
- Use explicit return (acc + length) instead of acc += mutation
- Add instancePath to schema validation error messages
- Document 'empty' scenario fallback in renderWithScenario

* chore(store): regenerate AUTO_GENERATED files from staging API

Upstream API changes: relay task status endpoint, updated gasLimit
description, deadlock analysis types in safe-shield.

* tests(web): address PR review - revert PushNotifications refactor, use MSW fixtures in AssetsTable test

- Revert GlobalPushNotifications utils extraction (should be a separate PR)
- Refactor AssetsTable test to use shared MSW fixtures and test builders
  instead of inline mock data

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-03-18 11:40:00 +01:00

28 lines
756 B
TypeScript

/**
* MSW (Mock Service Worker) utilities for Storybook and testing
*
* This module re-exports fixtures for convenient access.
* For handler creation, import directly from './handlers' or './fixtures'.
*
* @example Using fixtures in stories
* ```typescript
* import { balancesFixtures, safeFixtures, chainFixtures } from '@safe-global/test/msw/fixtures'
* ```
*/
// Re-export fixtures for convenient access
export {
portfolioFixtures,
balancesFixtures,
positionsFixtures,
safeFixtures,
chainFixtures,
safeAppsFixtures,
SAFE_ADDRESSES,
} from './fixtures'
export type { FixtureScenario } from './fixtures'
// Test server factory
export { createTestServer } from './testServer'
export type { TestServerOptions } from './testServer'