Skip to content

Commit

Permalink
Add Images E2E test
Browse files Browse the repository at this point in the history
  • Loading branch information
ns476 committed Jan 15, 2025
1 parent af4a38e commit 53ce7de
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/wrangler/e2e/dev-with-resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,40 @@ describe.sequential.each(RUNTIMES)("Bindings: $flags", ({ runtime, flags }) => {
await expect(res.text()).resolves.toBe("env.WORKFLOW is available");
});

it("exposes Images bindings", async () => {
describe.sequential.each([
{ imagesMode: "remote", extraFlags: "" },
{ imagesMode: "local", extraFlags: "--experimental-images-local-mode" },
] as const)("Images Binding Mode: $imagesMode", async ({ extraFlags }) => {
await helper.seed({
"wrangler.toml": dedent`
name = "my-images-demo"
main = "src/index.ts"
compatibility_date = "2024-12-27"
[images]
binding = "IMAGES"
`,
"src/index.ts": dedent`
export default {
async fetch(request, env, ctx) {
if (env.IMAGES === undefined) {
return new Response("env.IMAGES is undefined");
}
return new Response("env.IMAGES is available");
}
}
`,
});
const worker = helper.runLongLived(`wrangler dev ${flags} ${extraFlags}`);
const { url } = await worker.waitForReady();
const res = await fetch(url);

await expect(res.text()).resolves.toBe("env.IMAGES is available");
});
});

// TODO(soon): implement E2E tests for other bindings
it.todo("exposes hyperdrive bindings");
it.skipIf(isLocal).todo("exposes send email bindings");
Expand Down

0 comments on commit 53ce7de

Please sign in to comment.