@@ -2426,6 +2426,44 @@ describe("normalizeAndValidateConfig()", () => {
24262426 "test-worker-name-test-class"
24272427 ) ;
24282428 } ) ;
2429+
2430+ it ( "should error for invalid container app fields" , ( ) => {
2431+ const { diagnostics } = normalizeAndValidateConfig (
2432+ {
2433+ name : "test-worker" ,
2434+ containers : [
2435+ {
2436+ image : "something" ,
2437+ class_name : "test-class" ,
2438+ rollout_kind : "invalid" ,
2439+ instance_type : "invalid" ,
2440+ max_instances : "invalid" ,
2441+ image_build_context : 123 ,
2442+ image_vars : "invalid" ,
2443+ scheduling_policy : "invalid" ,
2444+ unknown_field : "value" ,
2445+ } ,
2446+ ] ,
2447+ } as unknown as RawConfig ,
2448+ undefined ,
2449+ undefined ,
2450+ { env : undefined }
2451+ ) ;
2452+
2453+ expect ( diagnostics . renderWarnings ( ) ) . toMatchInlineSnapshot ( `
2454+ "Processing wrangler configuration:
2455+ - Unexpected fields found in containers field: \\"unknown_field\\""
2456+ ` ) ;
2457+ expect ( diagnostics . renderErrors ( ) ) . toMatchInlineSnapshot ( `
2458+ "Processing wrangler configuration:
2459+ - Expected \\"containers.rollout_kind\\" field to be one of [\\"full_auto\\",\\"full_manual\\",\\"none\\"] but got \\"invalid\\".
2460+ - Expected \\"containers.instance_type\\" field to be one of [\\"dev\\",\\"basic\\",\\"standard\\"] but got \\"invalid\\".
2461+ - Expected \\"containers.max_instances\\" to be of type number but got \\"invalid\\".
2462+ - Expected \\"containers.image_build_context\\" to be of type string but got 123.
2463+ - Expected \\"containers.image_vars\\" to be of type object but got \\"invalid\\".
2464+ - Expected \\"containers.scheduling_policy\\" field to be one of [\\"regional\\",\\"moon\\",\\"default\\"] but got \\"invalid\\"."
2465+ ` ) ;
2466+ } ) ;
24292467 } ) ;
24302468
24312469 describe ( "[kv_namespaces]" , ( ) => {
0 commit comments