@@ -10,7 +10,11 @@ import {
1010 vi ,
1111} from "vitest" ;
1212import { getPlatformProxy } from "./shared" ;
13- import type { Hyperdrive , KVNamespace } from "@cloudflare/workers-types" ;
13+ import type {
14+ Fetcher ,
15+ Hyperdrive ,
16+ KVNamespace ,
17+ } from "@cloudflare/workers-types" ;
1418import type { Unstable_DevWorker } from "wrangler" ;
1519
1620type Env = {
@@ -23,6 +27,7 @@ type Env = {
2327 MY_BUCKET : R2Bucket ;
2428 MY_D1 : D1Database ;
2529 MY_HYPERDRIVE : Hyperdrive ;
30+ ASSETS : Fetcher ;
2631} ;
2732
2833const wranglerConfigFilePath = path . join ( __dirname , ".." , "wrangler.jsonc" ) ;
@@ -123,6 +128,17 @@ describe("getPlatformProxy - env", () => {
123128 }
124129 } ) ;
125130
131+ it ( "correctly obtains functioning ASSETS bindings" , async ( ) => {
132+ const { env, dispose } = await getPlatformProxy < Env > ( {
133+ configPath : wranglerConfigFilePath ,
134+ } ) ;
135+ const { ASSETS } = env ;
136+ const res = await ASSETS . fetch ( "https://0.0.0.0/test.txt" ) ;
137+ const text = await res . text ( ) ;
138+ expect ( text ) . toEqual ( "this is a test text file!\n" ) ;
139+ await dispose ( ) ;
140+ } ) ;
141+
126142 it ( "correctly obtains functioning KV bindings" , async ( ) => {
127143 const { env, dispose } = await getPlatformProxy < Env > ( {
128144 configPath : wranglerConfigFilePath ,
0 commit comments