e0e362d700
SDK Tests / changes (push) Successful in 2m29s
Real E2E Tests / changes (push) Successful in 2m29s
SDK Tests / Python SDK Tests (sandbox) (push) Waiting to run
SDK Tests / CLI Quality (push) Waiting to run
SDK Tests / CLI Tests (push) Waiting to run
SDK Tests / Python SDK Quality (code-interpreter) (push) Waiting to run
SDK Tests / Python SDK Quality (sandbox) (push) Waiting to run
SDK Tests / Python SDK Tests (code-interpreter) (push) Waiting to run
SDK Tests / JavaScript SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / JavaScript SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Kotlin SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Kotlin SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / C# SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / C# SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Go SDK Quality And Tests (push) Waiting to run
Deploy Docs Pages / build (push) Has been cancelled
Deploy Docs Pages / deploy (push) Has been cancelled
Real E2E Tests / JavaScript E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Python E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Java E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / C# E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Go E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Real E2E CI (push) Has been cancelled
SDK Tests / SDK CI (push) Has been cancelled
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { CodeInterpreter } from "../dist/index.js";
|
|
import { DEFAULT_EXECD_PORT } from "../../../sandbox/javascript/dist/index.js";
|
|
|
|
test("CodeInterpreter.create forwards endpoint headers to adapter factory", async () => {
|
|
const calls = [];
|
|
const sandbox = {
|
|
connectionConfig: {
|
|
protocol: "https",
|
|
headers: { "x-global": "global" },
|
|
},
|
|
async getEndpoint(port) {
|
|
assert.equal(port, DEFAULT_EXECD_PORT);
|
|
return {
|
|
endpoint: "sandbox.internal:3456",
|
|
headers: { "x-endpoint": "endpoint" },
|
|
};
|
|
},
|
|
};
|
|
const codes = { kind: "codes" };
|
|
const adapterFactory = {
|
|
createCodes(opts) {
|
|
calls.push(opts);
|
|
return codes;
|
|
},
|
|
};
|
|
|
|
const interpreter = await CodeInterpreter.create(sandbox, { adapterFactory });
|
|
|
|
assert.equal(interpreter.codes, codes);
|
|
assert.equal(calls.length, 1);
|
|
assert.equal(calls[0].execdBaseUrl, "https://sandbox.internal:3456");
|
|
assert.deepEqual(calls[0].endpointHeaders, { "x-endpoint": "endpoint" });
|
|
});
|