mirror of
https://github.com/we-promise/sure.git
synced 2026-05-24 21:14:56 +00:00
* feat(api): add import preflight validation * fix(api): harden import preflight validation
28 lines
733 B
Ruby
28 lines
733 B
Ruby
require "test_helper"
|
|
|
|
class MintImportTest < ActiveSupport::TestCase
|
|
setup do
|
|
@family = families(:dylan_family)
|
|
end
|
|
|
|
test "default column mappings are applied after create" do
|
|
import = @family.imports.create!(type: "MintImport")
|
|
|
|
MintImport.default_column_mappings.each do |attribute, value|
|
|
assert_equal value, import.public_send(attribute)
|
|
end
|
|
end
|
|
|
|
test "generated rows preserve stable source row numbers" do
|
|
import = @family.imports.create!(
|
|
type: "MintImport",
|
|
raw_file_str: file_fixture("imports/mint.csv").read,
|
|
col_sep: ","
|
|
)
|
|
|
|
import.generate_rows_from_csv
|
|
|
|
assert_equal (1..10).to_a, import.rows.order(:source_row_number).pluck(:source_row_number)
|
|
end
|
|
end
|