@@ -2,7 +2,11 @@ import path from "path";
22import { D1Database , R2Bucket } from "@cloudflare/workers-types" ;
33import { beforeEach , describe , expect , it , vi } from "vitest" ;
44import { getPlatformProxy } from "./shared" ;
5- import type { Hyperdrive , KVNamespace } from "@cloudflare/workers-types" ;
5+ import type {
6+ Fetcher ,
7+ Hyperdrive ,
8+ KVNamespace ,
9+ } from "@cloudflare/workers-types" ;
610import type { Unstable_DevWorker } from "wrangler" ;
711
812type Env = {
@@ -15,6 +19,7 @@ type Env = {
1519 MY_BUCKET : R2Bucket ;
1620 MY_D1 : D1Database ;
1721 MY_HYPERDRIVE : Hyperdrive ;
22+ ASSETS : Fetcher ;
1823} ;
1924
2025const wranglerTomlFilePath = path . join ( __dirname , ".." , "wrangler.toml" ) ;
@@ -115,6 +120,17 @@ describe("getPlatformProxy - env", () => {
115120 }
116121 } ) ;
117122
123+ it ( "correctly obtains functioning ASSETS bindings" , async ( ) => {
124+ const { env, dispose } = await getPlatformProxy < Env > ( {
125+ configPath : wranglerTomlFilePath ,
126+ } ) ;
127+ const { ASSETS } = env ;
128+ const res = await ASSETS . fetch ( "https://0.0.0.0/test.txt" ) ;
129+ const text = await res . text ( ) ;
130+ expect ( text ) . toEqual ( "this is a test text file!\n" ) ;
131+ await dispose ( ) ;
132+ } ) ;
133+
118134 it ( "correctly obtains functioning KV bindings" , async ( ) => {
119135 const { env, dispose } = await getPlatformProxy < Env > ( {
120136 configPath : wranglerTomlFilePath ,
0 commit comments