Skip to content

Commit

Permalink
chore(ecosystem-tests): fix flaky vercel-edge, cloudflare-worker, and…
Browse files Browse the repository at this point in the history
… deno tests (#626)
  • Loading branch information
stainless-bot committed Jan 13, 2024
1 parent 6456004 commit adbf4b0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions ecosystem-tests/cloudflare-worker/src/uploadWebApiTestCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,31 +116,31 @@ export function uploadWebApiTestCases({
// @ts-expect-error we don't type support for `string` to avoid a footgun with passing the file path
const file = await toFile(fineTune, 'finetune.jsonl');
const result = await client.files.create({ file, purpose: 'fine-tune' });
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
it('toFile handles Blob', async () => {
const result = await client.files.create({ file: await toFile(new Blob([fineTune]), 'finetune.jsonl'), purpose: 'fine-tune' });
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
it('toFile handles Uint8Array', async () => {
const result = await client.files.create({
file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'),
purpose: 'fine-tune',
});
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
it('toFile handles ArrayBuffer', async () => {
const result = await client.files.create({
file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'),
purpose: 'fine-tune',
});
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
it('toFile handles DataView', async () => {
const result = await client.files.create({
file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'),
purpose: 'fine-tune',
});
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
}
8 changes: 4 additions & 4 deletions ecosystem-tests/deno/main_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,26 @@ Deno.test(async function toFileHandlesBlob() {
file: await toFile(new Blob([fineTune]), 'finetune.jsonl'),
purpose: 'fine-tune',
});
assertEquals(result.status, 'uploaded');
assertEquals(result.filename, 'finetune.jsonl');
});
Deno.test(async function toFileHandlesUint8Array() {
const result = await client.files.create({
file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'),
purpose: 'fine-tune',
});
assertEquals(result.status, 'uploaded');
assertEquals(result.filename, 'finetune.jsonl');
});
Deno.test(async function toFileHandlesArrayBuffer() {
const result = await client.files.create({
file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'),
purpose: 'fine-tune',
});
assertEquals(result.status, 'uploaded');
assertEquals(result.filename, 'finetune.jsonl');
});
Deno.test(async function toFileHandlesDataView() {
const result = await client.files.create({
file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.json'),
purpose: 'fine-tune',
});
assertEquals(result.status, 'uploaded');
assertEquals(result.filename, 'finetune.jsonl');
});
10 changes: 5 additions & 5 deletions ecosystem-tests/vercel-edge/src/uploadWebApiTestCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,28 +147,28 @@ export function uploadWebApiTestCases({
// @ts-ignore this only doesn't error in vercel build...
const file = await toFile(fineTune, 'finetune.jsonl');
const result = await client.files.create({ file, purpose: 'fine-tune' });
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
it('toFile handles Blob', async () => {
const result = await client.files.create({
file: await toFile(new Blob([fineTune]), 'finetune.jsonl'),
purpose: 'fine-tune',
});
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
it('toFile handles Uint8Array', async () => {
const result = await client.files.create({
file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'),
purpose: 'fine-tune',
});
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
it('toFile handles ArrayBuffer', async () => {
const result = await client.files.create({
file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'),
purpose: 'fine-tune',
});
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
if (runtime !== 'edge') {
// this fails in edge for some reason
Expand All @@ -177,7 +177,7 @@ export function uploadWebApiTestCases({
file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'),
purpose: 'fine-tune',
});
expectEqual(result.status, 'uploaded');
expectEqual(result.filename, 'finetune.jsonl');
});
}
}

0 comments on commit adbf4b0

Please sign in to comment.