mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
5eab8128bd
Two small leftovers, moved to the domains that own them. ephemeralTokens holds the short-lived tokens the WebSocket handshake and the file-download links use. It already had startTokenCleanup/stopTokenCleanup with an unref-ed handle — the right shape. What was missing is anyone calling stop: index.ts kicked the sweep off with a bare require() after listen() and nothing ever ended it. AuthService owns that lifecycle now, through onModuleInit/onModuleDestroy, which is where it belongs — it is the service that issues the tokens. The store itself stays module state. websocket.ts consumes tokens from outside the container, and a token store is only useful if the issuer and the consumer share one. Same reasoning as the weather cache in #1835. inAppNotificationActions is a 22-line handler registry with exactly one consumer; it moves next to it as notifications/in-app-actions.ts. services/ is down to 9 files, from 44.
22 lines
729 B
TypeScript
22 lines
729 B
TypeScript
/**
|
|
* Unit tests for inAppNotificationActions — NOTIF-ACT-001 through NOTIF-ACT-008.
|
|
* Pure Map registry — no DB or external dependencies.
|
|
*/
|
|
import { describe, it, expect } from 'vitest';
|
|
import { getAction } from '../../../../src/nest/notifications/in-app-actions';
|
|
|
|
describe('getAction — built-in registrations', () => {
|
|
it('NOTIF-ACT-001 — test_approve is pre-registered', () => {
|
|
const handler = getAction('test_approve');
|
|
expect(handler).toBeDefined();
|
|
expect(typeof handler).toBe('function');
|
|
});
|
|
|
|
it('NOTIF-ACT-002 — test_deny is pre-registered', () => {
|
|
const handler = getAction('test_deny');
|
|
expect(handler).toBeDefined();
|
|
expect(typeof handler).toBe('function');
|
|
});
|
|
|
|
});
|