Skip to content

Commit ffabad1

Browse files
committed
Fix tests
1 parent 39713de commit ffabad1

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

lib/optimizely/config/datafile_project_config.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ def initialize(datafile, logger, error_handler)
120120
@excluded_holdouts = {}
121121
@flag_holdouts_map = {}
122122

123-
@holdout_id_map = generate_key_map(@holdouts, 'id')
124123
@holdouts.each do |holdout|
125124
next unless holdout['status'] == 'Running'
126125

126+
@holdout_id_map[holdout['id']] = holdout
127+
127128
if holdout['includedFlags'].nil? || holdout['includedFlags'].empty?
128129
@global_holdouts[holdout['id']] = holdout
129130

spec/config/datafile_project_config_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,16 +1298,16 @@
12981298
holdout = config_with_holdouts.get_holdout('holdout_1')
12991299
expect(holdout).not_to be_nil
13001300
expect(holdout['id']).to eq('holdout_1')
1301-
expect(holdout['key']).to eq('test_holdout')
1301+
expect(holdout['key']).to eq('global_holdout')
13021302
expect(holdout['status']).to eq('Running')
13031303
end
13041304

13051305
it 'should return holdout regardless of status when valid ID is provided' do
13061306
holdout = config_with_holdouts.get_holdout('holdout_2')
13071307
expect(holdout).not_to be_nil
13081308
expect(holdout['id']).to eq('holdout_2')
1309-
expect(holdout['key']).to eq('another_holdout')
1310-
expect(holdout['status']).to eq('Inactive')
1309+
expect(holdout['key']).to eq('specific_holdout')
1310+
expect(holdout['status']).to eq('Running')
13111311
end
13121312

13131313
it 'should return nil for non-existent holdout ID' do
@@ -1363,20 +1363,20 @@
13631363
'key' => 'global',
13641364
'status' => 'Running',
13651365
'includedFlags' => [],
1366-
'excludedFlags' => %w[boolean_feature string_single_variable_feature]
1366+
'excludedFlags' => ['553339214', '594060']
13671367
},
13681368
{
13691369
'id' => 'specific_holdout',
13701370
'key' => 'specific',
13711371
'status' => 'Running',
1372-
'includedFlags' => %w[multi_variate_feature empty_feature],
1372+
'includedFlags' => ['594089', '594032'],
13731373
'excludedFlags' => []
13741374
},
13751375
{
13761376
'id' => 'inactive_holdout',
13771377
'key' => 'inactive',
13781378
'status' => 'Inactive',
1379-
'includedFlags' => ['boolean_feature'],
1379+
'includedFlags' => ['553339214'],
13801380
'excludedFlags' => []
13811381
}
13821382
]

0 commit comments

Comments
 (0)