Skip to content

Commit 38fbde2

Browse files
committed
test: add credential override test
Signed-off-by: Nick Hale <[email protected]>
1 parent e7cb55c commit 38fbde2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
credentials: github.com/gptscript-ai/credential as test.ts.credential_override with TEST_CRED as env
2+
3+
#!/usr/bin/env bash
4+
5+
echo "${TEST_CRED}"

tests/gptscript.test.ts

+13
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ describe("gptscript module", () => {
106106
expect(result).toContain("Calvin Coolidge")
107107
})
108108

109+
test("should override credentials correctly", async () => {
110+
const testGptPath = path.join(__dirname, "fixtures", "credential-override.gpt")
111+
112+
const result = await (await g.run(testGptPath, {
113+
disableCache: true,
114+
credentialOverride: 'test.ts.credential_override:TEST_CRED=foo',
115+
})).text()
116+
117+
expect(result).toBeDefined()
118+
expect(result).toContain("foo")
119+
})
120+
109121
test("run executes and stream a file correctly", async () => {
110122
let out = ""
111123
let err = undefined
@@ -167,6 +179,7 @@ describe("gptscript module", () => {
167179
expect(err).toBeUndefined()
168180
})
169181

182+
170183
describe("evaluate with multiple tools", () => {
171184
test("multiple tools", async () => {
172185
const t0 = {

0 commit comments

Comments
 (0)