Skip to content

Commit

Permalink
Fixed the 3 failing tests in the table exporter model Spec file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier-Jimenez-18 committed Oct 16, 2023
1 parent 1bd2f21 commit 13670b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
16 changes: 1 addition & 15 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,6 @@ SET row_security = off;
CREATE SCHEMA ctgov;


--
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
--

CREATE SCHEMA public;


--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON SCHEMA public IS 'standard public schema';


--
-- Name: support; Type: SCHEMA; Schema: -; Owner: -
--
Expand Down Expand Up @@ -4557,7 +4543,7 @@ ALTER TABLE ONLY support.file_records
-- PostgreSQL database dump complete
--

SET search_path TO ctgov,support,public;
SET search_path TO ctgov, support, public;

INSERT INTO "schema_migrations" (version) VALUES
('20160630191037'),
Expand Down
14 changes: 13 additions & 1 deletion spec/models/utils/util_table_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@
File.open('public/static/tmp/export/outcomes.txt', 'wb+') do |file|
table_exporter.export_table('outcomes', file, '|')
end
expect(File.read('public/static/tmp/export/outcomes.txt')).to eq(File.read('spec/support/outcomes.txt'))
result_file = ''
File.open('public/static/tmp/export/outcomes.txt', 'r') do |input_file|
output_lines = ''
# Iterate through each line in the input file and remove the first column
input_file.each_line do |line|
columns = line.chomp.split('|')
columns.shift
modified_line = columns.join('|')
output_lines << modified_line + "\n"
end
result_file = output_lines
end
expect(result_file).to eq(File.read('spec/support/outcomes.txt'))
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/support/outcomes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
id|nct_id|outcome_type|title|description|time_frame|population|anticipated_posting_date|anticipated_posting_month_year|units|units_analyzed|dispersion_type|param_type
1|NCT05594173|Primary|Number of Chewing Cycles Per Bolus|Using surface electromyography (sEMG) of the masseter muscle, we will count the number of muscle contraction spikes (i.e. chewing cycles) seen for chewing activity for a single comfortable bite of each bolus type.|Baseline (single timepoint only)|Data for 3 additional participants could not be analyzed due to poor electromyography signal quality.|||number of chewing cycles||Standard Deviation|Mean
2|NCT05594173|Primary|Total Chewing Duration Per Bolus|Using surface electromyography (sEMG) of the masseter muscle, we will count the total duration of chewing activity for a single comfortable bite of each bolus type.|Baseline (single timepoint only)|Data for 3 additional participants could not be analyzed due to poor EMG signal quality.|||seconds||Standard Deviation|Mean
nct_id|outcome_type|title|description|time_frame|population|anticipated_posting_date|anticipated_posting_month_year|units|units_analyzed|dispersion_type|param_type
NCT05594173|Primary|Number of Chewing Cycles Per Bolus|Using surface electromyography (sEMG) of the masseter muscle, we will count the number of muscle contraction spikes (i.e. chewing cycles) seen for chewing activity for a single comfortable bite of each bolus type.|Baseline (single timepoint only)|Data for 3 additional participants could not be analyzed due to poor electromyography signal quality.|||number of chewing cycles||Standard Deviation|Mean
NCT05594173|Primary|Total Chewing Duration Per Bolus|Using surface electromyography (sEMG) of the masseter muscle, we will count the total duration of chewing activity for a single comfortable bite of each bolus type.|Baseline (single timepoint only)|Data for 3 additional participants could not be analyzed due to poor EMG signal quality.|||seconds||Standard Deviation|Mean

0 comments on commit 13670b7

Please sign in to comment.