Run integration tests with `replicate/canary` model (#283) · ckizer/replicate-javascript@8d8e599 · GitHub
Skip to content

Commit 8d8e599

Browse files
author
Mattt
authored
Run integration tests with replicate/canary model (replicate#283)
* Run integration tests with replicate/canary model * Update expected output * Add test matrix for Next.js * Reorder test matrix configurations * Add test matrix for build step
1 parent f70b3d9 commit 8d8e599

10 files changed

Lines changed: 39 additions & 24 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 20 additions & 9 deletions

‎integration/bun/index.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ import type {
1919

2020
test("main", async () => {
2121
const output = await main();
22-
expect(output).toContain("Brünnhilde Bun");
22+
expect(output).toEqual("hello there, Brünnhilde Bun");
2323
});

‎integration/commonjs/index.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ const replicate = new Replicate({
55
});
66

77
module.exports = async function main() {
8-
return await replicate.run(
9-
"replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
8+
const output = await replicate.run(
9+
"replicate/canary:30e22229542eb3f79d4f945dacb58d32001b02cc313ae6f54eef27904edf3272",
1010
{
1111
input: {
1212
text: "Claire CommonJS",
1313
},
1414
}
1515
);
16+
return output.join("").trim();
1617
};

‎integration/commonjs/index.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ const main = require("./index");
44

55
test("main", async () => {
66
const output = await main();
7-
assert.equal(output, "hello Claire CommonJS");
7+
assert.equal(output, "hello there, Claire CommonJS");
88
});

‎integration/deno/index.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ Deno.test({
2121
name: "main",
2222
async fn() {
2323
const output = await main();
24-
assertEquals({ output }, { output: "hello Deno the dinosaur" });
24+
assertEquals({ output }, { output: "hello there, Deno the dinosaur" });
2525
},
2626
});

‎integration/deno/index.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ const replicate = new Replicate({
55
});
66

77
export default async function main() {
8-
return await replicate.run(
9-
"replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
8+
const output = (await replicate.run(
9+
"replicate/canary:30e22229542eb3f79d4f945dacb58d32001b02cc313ae6f54eef27904edf3272",
1010
{
1111
input: {
1212
text: "Deno the dinosaur",
1313
},
1414
}
15-
);
15+
)) as string[];
16+
return output.join("").trim();
1617
}

‎integration/esm/index.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ const replicate = new Replicate({
55
});
66

77
export default async function main() {
8-
return await replicate.run(
9-
"replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
8+
const output = await replicate.run(
9+
"replicate/canary:30e22229542eb3f79d4f945dacb58d32001b02cc313ae6f54eef27904edf3272",
1010
{
1111
input: {
1212
text: "Evelyn ESM",
1313
},
1414
}
1515
);
16+
return Array.isArray(output) ? output.join("").trim() : String(output).trim();
1617
}

‎integration/esm/index.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import main from "./index.js";
44

55
test("main", async () => {
66
const output = await main();
7-
assert.equal(output, "hello Evelyn ESM");
7+
assert.equal(output, "hello there, Evelyn ESM");
88
});

‎integration/typescript/index.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ import type {
2020

2121
test("main", async () => {
2222
const output = await main();
23-
assert.equal(output, "hello Tracy TypeScript");
23+
assert.equal(output, "hello there, Tracy TypeScript");
2424
});

‎integration/typescript/index.ts‎

Lines changed: 4 additions & 3 deletions

0 commit comments

Comments
 (0)