device-oauth-performance.test.mjs
sha256:fbe982a22c05c6fe2e93876f250deecdb43d883f648b4e1810c7546caa9f17db
docs: activate KNOWTATION- board identity and preserve livi…
Human
minor
⚠ breaking
1 day 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
1 commit
sha256:fbe982a22c05c6fe2e93876f250deecdb43d883f648b4e1810c7546caa9f17db
docs: activate KNOWTATION- board identity and preserve livi…
Human
minor
⚠
1 day ago