Skip to content

Commit e1c14fa

Browse files
authored
Merge pull request #57 from thedadams/check-dup-events
chore: check for duplicate CallFinish events
2 parents 0d56902 + 5b27142 commit e1c14fa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/gptscript.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as gptscript from "../src/gptscript"
2-
import {ArgumentSchemaType, PropertyType, ToolType} from "../src/gptscript"
2+
import {ArgumentSchemaType, PropertyType, RunEventType, ToolType} from "../src/gptscript"
33
import path from "path"
44
import {fileURLToPath} from "url"
55

@@ -66,6 +66,14 @@ describe("gptscript module", () => {
6666
for (let output of data.output) out += `system: ${output.content}`
6767
})
6868

69+
let callFinished = false
70+
run.on(gptscript.RunEventType.CallFinish, (data: gptscript.CallFrame) => {
71+
if (data.type == RunEventType.CallFinish) {
72+
expect(callFinished).toBe(false)
73+
callFinished = true
74+
}
75+
})
76+
6977
await run.text()
7078
err = run.err
7179

0 commit comments

Comments
 (0)