From f80ebd9b6c647e64fb4e3a003bc65227a53b5812 Mon Sep 17 00:00:00 2001 From: Mitch Saltykov Date: Wed, 11 Sep 2024 16:46:24 -0400 Subject: [PATCH] remove hca_use_facilities_API flag usages --- app/models/health_care_application.rb | 21 +-------------- .../v0/health_care_applications_spec.rb | 26 +------------------ 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/app/models/health_care_application.rb b/app/models/health_care_application.rb index 57a087690b6..02cf81984ce 100644 --- a/app/models/health_care_application.rb +++ b/app/models/health_care_application.rb @@ -96,8 +96,6 @@ def process! prefill_fields unless valid? - Rails.logger.warn("HealthCareApplication::ValidationError: #{Flipper.enabled?(:hca_use_facilities_API)}") - StatsD.increment("#{HCA::Service::STATSD_KEY_PREFIX}.validation_error") StatsD.increment("#{HCA::Service::STATSD_KEY_PREFIX}.validation_error_short_form") if short_form? @@ -304,28 +302,11 @@ def send_failure_email log_exception_to_sentry(e) end - # If the hca_use_facilities_API flag is on then vaMedicalFacility will only - # validate for a string, else it will validate through the enum. This avoids - # changes to vets-website and vets-json-schema having to deploy simultaneously. def form_matches_schema if form.present? - JSON::Validator.fully_validate(current_schema, parsed_form).each do |v| + JSON::Validator.fully_validate(VetsJsonSchema::SCHEMAS[self.class::FORM_ID], parsed_form).each do |v| errors.add(:form, v.to_s) end end end - - def current_schema - feature_enabled_for_user = Flipper.enabled?(:hca_use_facilities_API, user) - Rails.logger.warn( - "HealthCareApplication::hca_use_facilitiesAPI enabled = #{feature_enabled_for_user}" - ) - - schema = VetsJsonSchema::SCHEMAS[self.class::FORM_ID] - return schema unless feature_enabled_for_user - - schema.deep_dup.tap do |c| - c['properties']['vaMedicalFacility'] = { type: 'string' }.as_json - end - end end diff --git a/spec/requests/v0/health_care_applications_spec.rb b/spec/requests/v0/health_care_applications_spec.rb index ef4ac7164dc..7f04f40af2c 100644 --- a/spec/requests/v0/health_care_applications_spec.rb +++ b/spec/requests/v0/health_care_applications_spec.rb @@ -462,7 +462,7 @@ def self.expect_async_submit end end - context 'with hca_use_facilities_API enabled' do + context 'with an arbitrary medical facility ID' do let(:current_user) { create(:user) } let(:params) do test_veteran['vaMedicalFacility'] = '000' @@ -480,8 +480,6 @@ def self.expect_async_submit before do sign_in_as(current_user) - Flipper.disable(:hca_use_facilities_API) - Flipper.enable(:hca_use_facilities_API, current_user) end it 'does not error on vaMedicalFacility validation' do @@ -491,28 +489,6 @@ def self.expect_async_submit expect(JSON.parse(response.body)['data']['attributes']).to eq(body) end end - - context 'with hca_use_facilities_API disabled' do - let(:current_user) { create(:user) } - let(:params) do - test_veteran['vaMedicalFacility'] = '000' - { - form: test_veteran.to_json - } - end - - before do - sign_in_as(current_user) - Flipper.disable(:hca_use_facilities_API) - end - - it 'errors on vaMedicalFacility validation' do - subject - - expect(JSON.parse(response.body)['errors']).not_to be_blank - expect(JSON.parse(response.body)['errors'].first['title']).to include('"000" did not match') - end - end end end end