37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { createReferenceFeatureInstalledInput } from "../../../src/features/reference-feature/adapters/create-reference-feature-input.ts";
|
|
import {
|
|
scopeSnapshot,
|
|
testExecutor,
|
|
type Transport,
|
|
} from "../../helpers/traffic-test-kit.ts";
|
|
|
|
/**
|
|
* The reference feature's real application input, wired to the real V3
|
|
* executor over an injected transport. Used to prove collection loads and
|
|
* multi-operation interactions stay bounded end to end.
|
|
*/
|
|
export function referenceFeatureOver(
|
|
transport: Transport,
|
|
options: Parameters<typeof testExecutor>[1] = {},
|
|
) {
|
|
const executor = testExecutor(transport, {
|
|
credentialHeaders: { authorization: "Bearer traffic-test-token" },
|
|
...options,
|
|
});
|
|
return createReferenceFeatureInstalledInput({
|
|
http: Object.freeze({
|
|
execute(operation, input, context) {
|
|
return executor.execute(operation, input, {
|
|
routeId: context.routeId,
|
|
scope: scopeSnapshot(),
|
|
...(context.signal === undefined ? {} : { signal: context.signal }),
|
|
...(context.intent === undefined ? {} : { intent: context.intent }),
|
|
...(context.execution === undefined
|
|
? {}
|
|
: { execution: context.execution }),
|
|
});
|
|
},
|
|
}),
|
|
}).input;
|
|
}
|