Skip to content

Commit

Permalink
Merge pull request #57 from thedadams/check-dup-events
Browse files Browse the repository at this point in the history
chore: check for duplicate CallFinish events
  • Loading branch information
thedadams authored Jun 17, 2024
2 parents 0d56902 + 5b27142 commit e1c14fa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/gptscript.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as gptscript from "../src/gptscript"
import {ArgumentSchemaType, PropertyType, ToolType} from "../src/gptscript"
import {ArgumentSchemaType, PropertyType, RunEventType, ToolType} from "../src/gptscript"
import path from "path"
import {fileURLToPath} from "url"

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

let callFinished = false
run.on(gptscript.RunEventType.CallFinish, (data: gptscript.CallFrame) => {
if (data.type == RunEventType.CallFinish) {
expect(callFinished).toBe(false)
callFinished = true
}
})

await run.text()
err = run.err

Expand Down

0 comments on commit e1c14fa

Please sign in to comment.