mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-23 07:09:39 +02:00
Ignore empty categories while importing (#789)
* Ignore empty categories while importing * Review fixes
This commit is contained in:
parent
ac27a1c87f
commit
77f166a5f8
5 changed files with 23 additions and 8 deletions
|
@ -39,7 +39,7 @@ class ImportTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
test "publishes a valid import" do
|
||||
assert_difference "Transaction.count", 2 do
|
||||
assert_difference -> { Transaction::Category.count } => 2, -> { Transaction.count } => 2 do
|
||||
@loaded_import.publish
|
||||
end
|
||||
|
||||
|
@ -48,6 +48,19 @@ class ImportTest < ActiveSupport::TestCase
|
|||
assert @loaded_import.complete?
|
||||
end
|
||||
|
||||
test "publishes a valid import with missing data" do
|
||||
@empty_import.update! raw_csv_str: valid_csv_with_missing_data
|
||||
assert_difference -> { Transaction::Category.count } => 1, -> { Transaction.count } => 2 do
|
||||
@empty_import.publish
|
||||
end
|
||||
|
||||
assert_not_nil Transaction.find_sole_by(name: Import::FALLBACK_TRANSACTION_NAME)
|
||||
|
||||
@empty_import.reload
|
||||
|
||||
assert @empty_import.complete?
|
||||
end
|
||||
|
||||
test "failed publish results in error status" do
|
||||
@empty_import.update! raw_csv_str: valid_csv_with_invalid_values
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue