mirror of
https://github.com/kamask-dev/pchelpmaster.git
synced 2026-11-11 05:49:38 +00:00
test(auth): add failing tests for auth service and pb_auth cookie
Tests first for task 2.2; the implementation comes separately. - AuthService contract (auth/testing/auth-service.contract.ts), run on the in-memory fake (unit) and on PocketBaseAuthService against a test PocketBase (integration) - integration: register persists the user, login maps id/email/name, restore with a valid, broken or missing token, signals follow the auth store, two users in separate injectors, NetworkError and kept session when PocketBase is unreachable - unit (jsdom): pb_auth cookie is written on sign-in and removed on sign-out with Path=/ and SameSite=Lax, loaded into the auth store before restore() at startup, untouched on the server platform - contract stubs that throw "Not implemented": User, AuthService, PocketBaseAuthService, provideAuth, InMemoryAuthService (signInAs, failNextWith) - docs/testing.md: note on the AuthService contract Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
115b5fb036
commit
74d3c660f9
@@ -76,6 +76,8 @@ export function describeTagRepositoryContract(
|
||||
|
||||
и вызывается дважды: в `in-memory-tag-repository.spec.ts` (быстро, в `pnpm test`) и в `pocketbase-tag-repository.integration.spec.ts` (на тестовом PocketBase, в `pnpm test:integration`).
|
||||
|
||||
Так же устроен контракт сервиса `AuthService`: `auth/testing/auth-service.contract.ts`. Файл контракта не `*.spec.ts`, поэтому `describe`/`it`/`expect` импортируются из `vitest` явно.
|
||||
|
||||
## Тестовый PocketBase
|
||||
|
||||
API-, integration- и e2e-тесты работают с **отдельным временным экземпляром** PocketBase, а не с `pocketbase/pb_data`:
|
||||
|
||||
Reference in New Issue
Block a user