Skip to content

Commit 7584ee7

Browse files
committed
Fix unit tests
1 parent 8108c73 commit 7584ee7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/optimizely/config/datafile_project_config.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,10 @@ def get_holdouts_for_flag(flag_id)
644644

645645
return [] if @holdouts.nil? || @holdouts.empty?
646646

647+
# Validate that the flag exists in the datafile
648+
flag_exists = @feature_flags.any? { |flag| flag['id'] == flag_id }
649+
return [] unless flag_exists
650+
647651
# Check cache and return persistent holdouts
648652
return @flag_holdouts_map[flag_id] if @flag_holdouts_map.key?(flag_id)
649653

0 commit comments

Comments
 (0)