Skip to content

Commit

Permalink
Use mock response builder in missed test
Browse files Browse the repository at this point in the history
  • Loading branch information
robatwilliams committed Dec 18, 2023
1 parent bf07182 commit 982437f
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/functions/functions.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,9 @@ describe('CHAT_COMPLETE', () => {
});

it('does not propagate empty cells in the params range to the API', async (t) => {
const mockResponseBody = {
id: 'chatcmpl-8X6b8XW77Md4oc06Yd3tc18lFzqT9',
object: 'chat.completion',
created: 0,
model: 'gpt-3.5-turbo-0613',
choices: [
{
index: 0,
message: { role: 'assistant', content: 'Hello' },
logprobs: null,
finish_reason: 'stop',
},
],
usage: { prompt_tokens: 78, completion_tokens: 23, total_tokens: 101 },
system_fingerprint: null,
};
t.mock.method(global, 'fetch', () => mockResponseOk(mockResponseBody));
t.mock.method(global, 'fetch', () =>
mockResponseOk(makeCompletionResponse()),
);

await chatComplete(
[['user', 'Say hello']],
Expand Down

0 comments on commit 982437f

Please sign in to comment.