moving
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled

This commit is contained in:
Oleg Maslov
2026-09-02 10:10:29 +02:00
commit 0c3e2ead3b
3841 changed files with 970576 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
/**
* Shared test utilities for e2e tests.
* Provides authenticated inject helper for local server tests (SEC-011).
*/
import type { FastifyInstance, InjectOptions } from 'fastify';
/**
* Shorthand: inject with auth token from the server's agentState.
* Returns the same result as server.inject().
*/
export function injectWithAuth(server: FastifyInstance, opts: InjectOptions) {
const token = server.agentState.wsSessionToken;
const existingHeaders = (opts.headers ?? {}) as Record<string, string>;
return server.inject({
...opts,
headers: {
...existingHeaders,
authorization: `Bearer ${token}`,
},
});
}