device-oauth-performance.test.mjs
32 lines 1.1 KB
Raw
sha256:4215cecbbabf5591b1ff69053cc938b4b6c800f0d487be40618c1d4254d8b67b security: npm audit fix pre-bridge 2026-09-05 Human 3 days ago
1 /**
2 * Phase B — device OAuth: performance tier (light).
3 *
4 * Bulk device authorization creation completes within a reasonable wall-clock
5 * budget on a temp data directory.
6 */
7
8 import { describe, it, afterEach } from 'node:test';
9 import assert from 'node:assert/strict';
10 import { createDeviceAuthorization } from '../hub/gateway/device-oauth-store.mjs';
11 import { createTempStrongStore } from './helpers/device-oauth-harness.mjs';
12
13 const cleanups = [];
14 afterEach(async () => {
15 while (cleanups.length) await cleanups.pop()();
16 });
17
18 describe('Phase B performance — bulk authorization create', () => {
19 it('50 createDeviceAuthorization calls complete under 5 seconds', async () => {
20 const tmp = await createTempStrongStore();
21 cleanups.push(tmp.cleanup);
22
23 const start = Date.now();
24 for (let i = 0; i < 50; i++) {
25 const created = await createDeviceAuthorization({ clientId: `perf-${i}` });
26 assert.ok(created.deviceCode);
27 assert.ok(created.userCode);
28 }
29 const elapsed = Date.now() - start;
30 assert.ok(elapsed < 5000, `50 creates took ${elapsed}ms (budget 5000ms)`);
31 });
32 });
File History 3 commits
sha256:4215cecbbabf5591b1ff69053cc938b4b6c800f0d487be40618c1d4254d8b67b security: npm audit fix pre-bridge 2026-09-05 Human 3 days ago
sha256:9eaa2a7ec9aaf5866cd03d0deadf843cca97778299d1857b5452f71d92a1880a feat(f24): flip DOCS_NOTION_HUB_KEY_AUTHORIZED=true (Tier 3) Human minor 17 days ago
sha256:e4c529f14a0bb908c1caaaeb3f95f3623a1a82e636e7e3722ca2cd3dc9821263 security: npm audit fix pre-bridge 2026-07-29 Human 41 days ago