|
120 | 120 | expect(log_event.http_verb).to eq(:post)
|
121 | 121 | end
|
122 | 122 |
|
| 123 | + it 'should create valid Event when create_impression_event is called without attributes and with EU' do |
| 124 | + @expected_impression_params[:region] = 'EU' |
| 125 | + experiment = project_config.get_experiment_from_key('test_experiment') |
| 126 | + metadata = { |
| 127 | + flag_key: '', |
| 128 | + rule_key: 'test_experiment', |
| 129 | + rule_type: 'experiment', |
| 130 | + variation_key: '111128' |
| 131 | + } |
| 132 | + impression_event = Optimizely::UserEventFactory.create_impression_event(project_config, experiment, '111128', metadata, 'test_user', nil) |
| 133 | + log_event = Optimizely::EventFactory.create_log_event(impression_event, spy_logger) |
| 134 | + expect(log_event.params).to eq(@expected_impression_params) |
| 135 | + expect(log_event.url).to eq(@expected_endpoints[:EU]) |
| 136 | + expect(log_event.http_verb).to eq(:post) |
| 137 | + end |
| 138 | + |
123 | 139 | it 'should create a valid Event when create_impression_event is called with attributes as a string value' do
|
124 | 140 | @expected_impression_params[:visitors][0][:attributes].unshift(
|
125 | 141 | entity_id: '111094',
|
|
629 | 645 | expect(log_event.http_verb).to eq(:post)
|
630 | 646 | end
|
631 | 647 |
|
| 648 | + it 'should create valid Event when create_conversion_event is called with Bucketing ID attribute and with EU' do |
| 649 | + @expected_conversion_params[:visitors][0][:attributes].unshift( |
| 650 | + { |
| 651 | + entity_id: '111094', |
| 652 | + key: 'browser_type', |
| 653 | + type: 'custom', |
| 654 | + value: 'firefox' |
| 655 | + }, |
| 656 | + entity_id: Optimizely::Helpers::Constants::CONTROL_ATTRIBUTES['BUCKETING_ID'], |
| 657 | + key: Optimizely::Helpers::Constants::CONTROL_ATTRIBUTES['BUCKETING_ID'], |
| 658 | + type: 'custom', |
| 659 | + value: 'variation' |
| 660 | + ) |
| 661 | + |
| 662 | + @expected_conversion_params[:region] = 'EU' |
| 663 | + |
| 664 | + user_attributes = { |
| 665 | + 'browser_type' => 'firefox', |
| 666 | + '$opt_bucketing_id' => 'variation' |
| 667 | + } |
| 668 | + conversion_event = Optimizely::UserEventFactory.create_conversion_event(project_config, event, 'test_user', user_attributes, nil) |
| 669 | + log_event = Optimizely::EventFactory.create_log_event(conversion_event, spy_logger) |
| 670 | + expect(log_event.params).to eq(@expected_conversion_params) |
| 671 | + expect(log_event.url).to eq(@expected_endpoints[:EU]) |
| 672 | + expect(log_event.http_verb).to eq(:post) |
| 673 | + end |
| 674 | + |
632 | 675 | it 'should create valid Event with user agent when bot_filtering is enabled' do
|
633 | 676 | # Test that create_conversion_event creates Event object
|
634 | 677 | # with right params when user agent attribute is provided and
|
|
0 commit comments