Skip to content

Commit 06e9fa5

Browse files
committed
Add integration test for Deno
1 parent 9121805 commit 06e9fa5

File tree

5 files changed

+158
-1
lines changed

5 files changed

+158
-1
lines changed

.github/workflows/ci.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ jobs:
141141
npm --prefix integration/${{ matrix.suite }} install "./${{ needs.build.outputs.tarball-name }}"
142142
npm --prefix integration/${{ matrix.suite }} test
143143
144-
145144
integration-bun:
146145
needs: [test, build]
147146
runs-on: ubuntu-latest
@@ -172,6 +171,29 @@ jobs:
172171
bun test && break || echo "Test failed, retrying..."
173172
done
174173
174+
integration-deno:
175+
needs: [test]
176+
runs-on: ubuntu-latest
177+
178+
env:
179+
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
180+
181+
strategy:
182+
matrix:
183+
deno-version: [v1.x]
184+
suite: [deno]
185+
186+
steps:
187+
- uses: actions/checkout@v4
188+
189+
- name: Use Deno ${{ matrix.deno-version }}
190+
uses: denoland/setup-deno@v1
191+
with:
192+
deno-version: ${{ matrix.deno-version }}
193+
- run: |
194+
cd integration/deno
195+
deno test --allow-env index.test.ts --allow-net
196+
175197
integration-nextjs:
176198
needs: [test, build]
177199
runs-on: ubuntu-latest

integration/deno/deno.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"replicate": "npm:replicate"
4+
}
5+
}

integration/deno/deno.lock

+88
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/deno/index.test.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { assertEquals } from "jsr:@std/assert";
2+
import main from "./index.ts";
3+
4+
// Verify exported types.
5+
import type {
6+
Status,
7+
Visibility,
8+
WebhookEventType,
9+
ApiError,
10+
Collection,
11+
Hardware,
12+
Model,
13+
ModelVersion,
14+
Prediction,
15+
Training,
16+
Page,
17+
ServerSentEvent,
18+
} from "replicate";
19+
20+
Deno.test({
21+
name: "main",
22+
async fn() {
23+
const output = await main();
24+
assertEquals({ output }, { output: "hello Deno the dinosaur" });
25+
},
26+
});

integration/deno/index.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Replicate from "replicate";
2+
3+
const replicate = new Replicate({
4+
auth: Deno.env.get("REPLICATE_API_TOKEN"),
5+
});
6+
7+
export default async function main() {
8+
return await replicate.run(
9+
"replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
10+
{
11+
input: {
12+
text: "Deno the dinosaur",
13+
},
14+
}
15+
);
16+
}

0 commit comments

Comments
 (0)