Skip to content

Commit 6fedeec

Browse files
committed
fix: move valid_days list inside macro for proper Jinja scoping
1 parent 2315a52 commit 6fedeec

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

macros/edr/tests/test_utils/sla_utils.sql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Shared utilities for SLA tests.
33
#}
44

5-
{# Valid day names (lowercase for comparison) #}
6-
{% set VALID_DAYS_OF_WEEK = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] %}
7-
85

96
{#
107
Validate that a timezone string is a valid IANA timezone name.
@@ -90,6 +87,8 @@
9087
Returns: list of lowercase day names, or empty list if none provided.
9188
#}
9289
{% macro normalize_day_of_week(day_of_week) %}
90+
{% set valid_days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] %}
91+
9392
{% if day_of_week is none or day_of_week == '' %}
9493
{{ return([]) }}
9594
{% endif %}
@@ -105,7 +104,7 @@
105104
{% set normalized = [] %}
106105
{% for day in days %}
107106
{% set day_lower = day | string | trim | lower %}
108-
{% if day_lower not in VALID_DAYS_OF_WEEK %}
107+
{% if day_lower not in valid_days %}
109108
{{ exceptions.raise_compiler_error(
110109
"Invalid day_of_week '" ~ day ~ "'. Must be one of: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday."
111110
) }}

0 commit comments

Comments
 (0)