()
| 509 | |
| 510 | /** Clear all sessions (tests only). */ |
| 511 | export async function clearSessions(): Promise<void> { |
| 512 | const ctx = requestCtx.getStore(); |
| 513 | if (ctx) { |
| 514 | ctx.sessions.clear(); |
| 515 | ctx.snapshots.clear(); |
| 516 | } |
| 517 | const store = storeInstance; |
| 518 | if (!store) return; |
| 519 | if (store instanceof InMemoryStateStore) { |
| 520 | store.clear(); |
| 521 | } else if (store instanceof PostgresStateStore) { |
| 522 | await store.clearCollection(SESSIONS_COLLECTION); |
| 523 | } |
| 524 | // Other AdcpStateStore implementations: no-op. Tests should inject a known store. |
| 525 | } |
no test coverage detected