Skip to content

Business intelligence made simple

Improved test for upload column types

Andrew Kanef77a23b0694c
diff --git a/test/support/line_items.csv b/test/support/line_items.csv
index 12ec088f..63d5b653 100644
--- a/test/support/line_items.csv
+++ b/test/support/line_items.csv
@@ -1,4 +1,4 @@
-a,b
-1,one
-2,two
-3,three
+a,b,c,d,e
+1,1.1,2021-01-01T00:00:00Z,2021-01-01,one
+2,2.2,2021-01-02T00:00:00Z,2021-01-02,two
+3,3.3,2021-01-03T00:00:00Z,2021-01-03,three
diff --git a/test/uploads_test.rb b/test/uploads_test.rb
index fabf50e1..43f365c6 100644
--- a/test/uploads_test.rb
+++ b/test/uploads_test.rb
@@ -5,7 +5,6 @@ class UploadsTest < ActionDispatch::IntegrationTest
Blazer::Upload.delete_all
end
- # TODO test column types
def test_create
post blazer.uploads_path, params: {upload: {table: "line_items", description: "Billing line items", file: fixture_file_upload("test/support/line_items.csv", "text/csv")}}
assert_response :redirect
@@ -19,6 +18,9 @@ class UploadsTest < ActionDispatch::IntegrationTest
column_types = Blazer::UploadsConnection.connection.select_all("SELECT column_name, data_type FROM information_schema.columns WHERE table_schema = 'uploads' AND table_name = 'line_items'").rows.to_h
assert_equal "bigint", column_types["a"]
- assert_equal "text", column_types["b"]
+ assert_equal "numeric", column_types["b"]
+ assert_equal "timestamp with time zone", column_types["c"]
+ assert_equal "date", column_types["d"]
+ assert_equal "text", column_types["e"]
end
end