refactor: clean up code formatting and update package dependencies
- Removed unnecessary blank lines and improved formatting for better readability in index.ts and converters.ts. - Updated package-lock.json to downgrade several dependencies for compatibility, including @protobufjs/eventemitter, @protobufjs/fetch, and others. - Enhanced error message in core.ts to clarify configuration options for the Command Code API key. - Added a test to ensure the correct handling of environment variable values in test-stream.ts.
This commit is contained in:
@@ -54,6 +54,27 @@ describe("streamCommandCode — auth", () => {
|
||||
assert.equal(server.requestCount(), 0)
|
||||
})
|
||||
|
||||
it("ignores the literal env-var name and falls back to env", async () => {
|
||||
server.mockResponse({
|
||||
type: "success",
|
||||
events: [JSON.stringify({ type: "finish", finishReason: "stop" })],
|
||||
})
|
||||
const { streamCommandCode } = createTestDeps({
|
||||
apiBase: server.baseUrl(),
|
||||
env: { COMMANDCODE_API_KEY: "env-key" },
|
||||
})
|
||||
|
||||
await collectEvents(
|
||||
streamCommandCode(makeModel(), makeContext(), { apiKey: "COMMANDCODE_API_KEY" }),
|
||||
)
|
||||
|
||||
assert.equal(
|
||||
server.lastRequestHeaders().authorization,
|
||||
"Bearer env-key",
|
||||
"should resolve from env, not send the literal var name as the token",
|
||||
)
|
||||
})
|
||||
|
||||
it("uses options.apiKey in the Authorization header", async () => {
|
||||
server.mockResponse({
|
||||
type: "success",
|
||||
|
||||
Reference in New Issue
Block a user