Skip to content

Commit

Permalink
test: fix the test
Browse files Browse the repository at this point in the history
  • Loading branch information
glorat committed Jul 2, 2023
1 parent bd131e4 commit abfd6eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/vitest/__tests__/ChatGPTClient.vitest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ describe('ChatGPTClient with bad key', async () => {
})

describe('ChatGPTClient streaming', () => {
const cache:Record<string, any> = {}

it('should stream a message', async () => {
const cache:Record<string, any> = {}
const chunks:string[] = []
const convCache = createCache(cache)
const clientOptions = {onProgress: (x:string) => chunks.push(x)}
const res = await sendChatMessage({message:'Generate 50 words of random text?', clientOptions, cache:convCache})
const chatOptions = {onProgress: (x:string) => chunks.push(x)}
const res = await sendChatMessage({message:'Generate 50 words of random text?', chatOptions, cache:convCache})
const { response } = res;
// Accumulated stream should match final message
expect(response).toEqual(chunks.join(''))
Expand Down

0 comments on commit abfd6eb

Please sign in to comment.