11/* eslint-disable @typescript-eslint/no-non-null-assertion */
2- import { FeatureFlags } from "@actions/expressions/features" ;
32import { nullTrace } from "../test-utils/null-trace.js" ;
43import { parseWorkflow } from "../workflows/workflow-parser.js" ;
54import { convertWorkflowTemplate , ErrorPolicy } from "./convert.js" ;
@@ -580,8 +579,8 @@ jobs:
580579 } ) ;
581580 } ) ;
582581
583- describe ( "schedule timezone with feature flags " , ( ) => {
584- it ( "allows timezone when allowCronTimezone is enabled " , async ( ) => {
582+ describe ( "schedule timezone" , ( ) => {
583+ it ( "allows timezone in schedule " , async ( ) => {
585584 const result = parseWorkflow (
586585 {
587586 name : "wf.yaml" ,
@@ -597,8 +596,7 @@ jobs:
597596 ) ;
598597
599598 const template = await convertWorkflowTemplate ( result . context , result . value ! , undefined , {
600- errorPolicy : ErrorPolicy . TryConversion ,
601- featureFlags : new FeatureFlags ( { allowCronTimezone : true } )
599+ errorPolicy : ErrorPolicy . TryConversion
602600 } ) ;
603601
604602 expect ( result . context . errors . getErrors ( ) ) . toHaveLength ( 0 ) ;
@@ -609,57 +607,6 @@ jobs:
609607 } ) ;
610608 } ) ;
611609
612- it ( "reports error when timezone is present but allowCronTimezone is disabled" , async ( ) => {
613- const result = parseWorkflow (
614- {
615- name : "wf.yaml" ,
616- content : `on:
617- schedule:
618- - cron: '0 0 * * *'
619- timezone: America/New_York
620- jobs:
621- build:
622- runs-on: ubuntu-latest`
623- } ,
624- nullTrace
625- ) ;
626-
627- const template = await convertWorkflowTemplate ( result . context , result . value ! , undefined , {
628- errorPolicy : ErrorPolicy . TryConversion ,
629- featureFlags : new FeatureFlags ( { allowCronTimezone : false } )
630- } ) ;
631-
632- // When timezone feature is disabled, error points at the timezone key
633- expect ( result . context . errors . getErrors ( ) ) . toHaveLength ( 1 ) ;
634- expect ( result . context . errors . getErrors ( ) [ 0 ] . message ) . toContain ( "Key 'timezone' is not supported" ) ;
635- // Schedule entry is dropped due to unsupported key
636- expect ( template . events ?. schedule ) . toHaveLength ( 0 ) ;
637- } ) ;
638-
639- it ( "reports error when timezone is present with no feature flags provided" , async ( ) => {
640- const result = parseWorkflow (
641- {
642- name : "wf.yaml" ,
643- content : `on:
644- schedule:
645- - cron: '0 0 * * *'
646- timezone: America/New_York
647- jobs:
648- build:
649- runs-on: ubuntu-latest`
650- } ,
651- nullTrace
652- ) ;
653-
654- await convertWorkflowTemplate ( result . context , result . value ! , undefined , {
655- errorPolicy : ErrorPolicy . TryConversion
656- } ) ;
657-
658- // Default is timezone disabled, so error points at the timezone key
659- expect ( result . context . errors . getErrors ( ) ) . toHaveLength ( 1 ) ;
660- expect ( result . context . errors . getErrors ( ) [ 0 ] . message ) . toContain ( "Key 'timezone' is not supported" ) ;
661- } ) ;
662-
663610 it ( "reports error when cron is missing from schedule entry" , async ( ) => {
664611 const result = parseWorkflow (
665612 {
@@ -675,8 +622,7 @@ jobs:
675622 ) ;
676623
677624 const template = await convertWorkflowTemplate ( result . context , result . value ! , undefined , {
678- errorPolicy : ErrorPolicy . TryConversion ,
679- featureFlags : new FeatureFlags ( { allowCronTimezone : true } )
625+ errorPolicy : ErrorPolicy . TryConversion
680626 } ) ;
681627
682628 // Both schema validation and converter report the missing cron
@@ -689,7 +635,7 @@ jobs:
689635 expect ( template . events ?. schedule ) . toHaveLength ( 0 ) ;
690636 } ) ;
691637
692- it ( "converts schedule without timezone when allowCronTimezone is enabled " , async ( ) => {
638+ it ( "converts schedule without timezone" , async ( ) => {
693639 const result = parseWorkflow (
694640 {
695641 name : "wf.yaml" ,
@@ -704,8 +650,7 @@ jobs:
704650 ) ;
705651
706652 const template = await convertWorkflowTemplate ( result . context , result . value ! , undefined , {
707- errorPolicy : ErrorPolicy . TryConversion ,
708- featureFlags : new FeatureFlags ( { allowCronTimezone : true } )
653+ errorPolicy : ErrorPolicy . TryConversion
709654 } ) ;
710655
711656 expect ( result . context . errors . getErrors ( ) ) . toHaveLength ( 0 ) ;
0 commit comments