From bb8a0ab3266d804ad4691ce24a25ab843eeb1b2d Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 7 Oct 2022 10:18:02 -0400 Subject: [PATCH] Remove unused FSMv2 analytics event mapping changelog: Internal, Code Quality, Remove unreachable code --- app/controllers/frontend_log_controller.rb | 14 +------------- .../controllers/frontend_log_controller_spec.rb | 17 ++--------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/app/controllers/frontend_log_controller.rb b/app/controllers/frontend_log_controller.rb index 9e1fc4ec064..3cae4dc8967 100644 --- a/app/controllers/frontend_log_controller.rb +++ b/app/controllers/frontend_log_controller.rb @@ -13,23 +13,11 @@ class FrontendLogController < ApplicationController 'IdV: prepare submitted' => :idv_in_person_prepare_submitted, 'IdV: switch_back visited' => :idv_in_person_switch_back_visited, 'IdV: switch_back submitted' => :idv_in_person_switch_back_submitted, - 'IdV: forgot password visited' => :idv_forgot_password, - 'IdV: password confirm visited' => :idv_review_info_visited, - 'IdV: password confirm submitted' => proc do |analytics| - analytics.idv_review_complete(success: true) - analytics.idv_final(success: true) - end, - 'IdV: personal key visited' => :idv_personal_key_visited, - 'IdV: personal key submitted' => :idv_personal_key_submitted, - 'IdV: personal key confirm visited' => :idv_personal_key_confirm_visited, - 'IdV: personal key confirm submitted' => :idv_personal_key_confirm_submitted, 'IdV: download personal key' => :idv_personal_key_downloaded, 'IdV: Native camera forced after failed attempts' => :idv_native_camera_forced, 'Multi-Factor Authentication: download backup code' => :multi_factor_auth_backup_code_download, 'Show Password button clicked' => :show_password_button_clicked, - }.transform_values do |method| - method.is_a?(Proc) ? method : AnalyticsEvents.instance_method(method) - end.freeze + }.transform_values { |method| AnalyticsEvents.instance_method(method) }.freeze # rubocop:enable Layout/LineLength def create diff --git a/spec/controllers/frontend_log_controller_spec.rb b/spec/controllers/frontend_log_controller_spec.rb index 007ce04a6a5..f118ae1af97 100644 --- a/spec/controllers/frontend_log_controller_spec.rb +++ b/spec/controllers/frontend_log_controller_spec.rb @@ -28,12 +28,12 @@ end context 'allowlisted analytics event' do - let(:event) { 'IdV: personal key visited' } + let(:event) { 'IdV: download personal key' } it 'succeeds' do action - expect(fake_analytics).to have_logged_event('IdV: personal key visited') + expect(fake_analytics).to have_logged_event('IdV: personal key downloaded') expect(response).to have_http_status(:ok) expect(json[:success]).to eq(true) end @@ -71,19 +71,6 @@ end end - context 'allowlisted analytics event with compound proc' do - let(:event) { 'IdV: password confirm submitted' } - - it 'succeeds' do - action - - expect(fake_analytics).to have_logged_event('IdV: review complete') - expect(fake_analytics).to have_logged_event('IdV: final resolution', success: true) - expect(response).to have_http_status(:ok) - expect(json[:success]).to eq(true) - end - end - context 'empty payload' do let(:payload) { {} }