11import { SELF } from "cloudflare:test" ;
2- import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
2+ import { afterEach , beforeEach , describe , expect , it , Mock , vi } from "vitest" ;
33import { applyConfigurationDefaults } from "../../packages/workers-shared/asset-worker/src/configuration" ;
44import Worker from "../../packages/workers-shared/asset-worker/src/index" ;
55import { getAssetWithMetadataFromKV } from "../../packages/workers-shared/asset-worker/src/utils/kv" ;
@@ -24,7 +24,7 @@ describe("[Asset Worker] `test slash normalization`", () => {
2424 afterEach ( ( ) => {
2525 vi . mocked ( getAssetWithMetadataFromKV ) . mockRestore ( ) ;
2626 } ) ;
27- beforeEach ( ( ) => {
27+ beforeEach ( async ( ) => {
2828 vi . mocked ( getAssetWithMetadataFromKV ) . mockImplementation (
2929 ( ) =>
3030 Promise . resolve ( {
@@ -37,14 +37,16 @@ describe("[Asset Worker] `test slash normalization`", () => {
3737 >
3838 ) ;
3939
40- vi . mocked ( applyConfigurationDefaults ) . mockImplementation ( ( ) => {
41- return {
42- html_handling : "none" ,
43- not_found_handling : "none" ,
44- run_worker_first : true ,
45- serve_directly : false ,
46- } ;
47- } ) ;
40+ const originalApplyConfigurationDefaults = (
41+ await vi . importActual <
42+ typeof import ( "../../packages/workers-shared/asset-worker/src/configuration" )
43+ > ( "../../packages/workers-shared/asset-worker/src/configuration" )
44+ ) . applyConfigurationDefaults ;
45+ vi . mocked ( applyConfigurationDefaults ) . mockImplementation ( ( ) => ( {
46+ ...originalApplyConfigurationDefaults ( { } ) ,
47+ html_handling : "none" ,
48+ not_found_handling : "none" ,
49+ } ) ) ;
4850 } ) ;
4951
5052 it ( "returns 200 leading encoded double slash" , async ( ) => {
0 commit comments