@@ -129,6 +129,7 @@ describe("normalizeAndValidateConfig()", () => {
129129 compliance_region : undefined ,
130130 images : undefined ,
131131 media : undefined ,
132+ stream : undefined ,
132133 } satisfies Config ) ;
133134 expect ( diagnostics . hasErrors ( ) ) . toBe ( false ) ;
134135 expect ( diagnostics . hasWarnings ( ) ) . toBe ( false ) ;
@@ -2294,6 +2295,69 @@ describe("normalizeAndValidateConfig()", () => {
22942295 } ) ;
22952296 } ) ;
22962297
2298+ // Stream
2299+ describe ( "[stream]" , ( ) => {
2300+ it ( "should error if stream is an array" , ( { expect } ) => {
2301+ const { diagnostics } = normalizeAndValidateConfig (
2302+ { stream : [ ] } as unknown as RawConfig ,
2303+ undefined ,
2304+ undefined ,
2305+ { env : undefined }
2306+ ) ;
2307+
2308+ expect ( diagnostics . hasWarnings ( ) ) . toBe ( false ) ;
2309+ expect ( diagnostics . renderErrors ( ) ) . toMatchInlineSnapshot ( `
2310+ "Processing wrangler configuration:
2311+ - The field "stream" should be an object but got []."
2312+ ` ) ;
2313+ } ) ;
2314+
2315+ it ( "should error if stream is a string" , ( { expect } ) => {
2316+ const { diagnostics } = normalizeAndValidateConfig (
2317+ { stream : "BAD" } as unknown as RawConfig ,
2318+ undefined ,
2319+ undefined ,
2320+ { env : undefined }
2321+ ) ;
2322+
2323+ expect ( diagnostics . hasWarnings ( ) ) . toBe ( false ) ;
2324+ expect ( diagnostics . renderErrors ( ) ) . toMatchInlineSnapshot ( `
2325+ "Processing wrangler configuration:
2326+ - The field "stream" should be an object but got "BAD"."
2327+ ` ) ;
2328+ } ) ;
2329+
2330+ it ( "should error if stream is a number" , ( { expect } ) => {
2331+ const { diagnostics } = normalizeAndValidateConfig (
2332+ { stream : 999 } as unknown as RawConfig ,
2333+ undefined ,
2334+ undefined ,
2335+ { env : undefined }
2336+ ) ;
2337+
2338+ expect ( diagnostics . hasWarnings ( ) ) . toBe ( false ) ;
2339+ expect ( diagnostics . renderErrors ( ) ) . toMatchInlineSnapshot ( `
2340+ "Processing wrangler configuration:
2341+ - The field "stream" should be an object but got 999."
2342+ ` ) ;
2343+ } ) ;
2344+
2345+ it ( "should error if stream is null" , ( { expect } ) => {
2346+ const { diagnostics } = normalizeAndValidateConfig (
2347+ { stream : null } as unknown as RawConfig ,
2348+ undefined ,
2349+ undefined ,
2350+ { env : undefined }
2351+ ) ;
2352+
2353+ expect ( diagnostics . hasWarnings ( ) ) . toBe ( false ) ;
2354+ expect ( diagnostics . renderErrors ( ) ) . toMatchInlineSnapshot ( `
2355+ "Processing wrangler configuration:
2356+ - The field "stream" should be an object but got null."
2357+ ` ) ;
2358+ } ) ;
2359+ } ) ;
2360+
22972361 // Worker Version Metadata
22982362 describe ( "[version_metadata]" , ( ) => {
22992363 it ( "should error if version_metadata is an array" , ( { expect } ) => {
0 commit comments