Skip to content

Commit 9394ab5

Browse files
hhoughggcmackenzie1
authored andcommitted
adding test for pipelines dev binding
1 parent 616bff9 commit 9394ab5

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/wrangler/e2e/dev-with-resources.test.ts

+33
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,39 @@ describe.sequential.each(RUNTIMES)("Bindings: $flags", ({ runtime, flags }) => {
561561
);
562562
});
563563

564+
it.skipIf(!isLocal)("exposes Pipelines bindings", async () => {
565+
await helper.seed({
566+
"wrangler.toml": dedent`
567+
name = "${workerName}"
568+
main = "src/index.ts"
569+
compatibility_date = "2024-10-20"
570+
571+
[[pipelines]]
572+
binding = "PIPELINE"
573+
pipeline = "my-pipeline"
574+
`,
575+
"src/index.ts": dedent`
576+
import { Pipeline } from "cloudflare:workers";
577+
578+
export default {
579+
async fetch(request, env, ctx) {
580+
if (env.PIPELINE === undefined) {
581+
return new Response("env.PIPELINE is undefined");
582+
}
583+
584+
return new Response("env.PIPELINE is available");
585+
}
586+
}
587+
`,
588+
});
589+
590+
const worker = helper.runLongLived(`wrangler dev ${flags}`);
591+
const { url } = await worker.waitForReady();
592+
const res = await fetch(url);
593+
594+
await expect(res.text()).resolves.toBe("env.PIPELINE is available");
595+
});
596+
564597
it.skipIf(!isLocal)("exposes queue producer/consumer bindings", async () => {
565598
const queueName = generateResourceName("queue");
566599

0 commit comments

Comments
 (0)