diff --git a/pkg/converters/gnucash/gnucash_transaction_data_file_importer_test.go b/pkg/converters/gnucash/gnucash_transaction_data_file_importer_test.go
index 1c14a498..df011df6 100644
--- a/pkg/converters/gnucash/gnucash_transaction_data_file_importer_test.go
+++ b/pkg/converters/gnucash/gnucash_transaction_data_file_importer_test.go
@@ -573,7 +573,7 @@ func TestGnuCashTransactionDatabaseFileParseImportedData_ParseValidAccountCurren
assert.Equal(t, "EUR", allNewAccounts[1].Currency)
}
-func TestGnuCashTransactionDatabaseFileParseImportedData_ParseAmount(t *testing.T) {
+func TestGnuCashTransactionDatabaseFileParseImportedData_ParseValidAmount(t *testing.T) {
converter := GnuCashTransactionDataImporter
context := core.NewNullContext()
@@ -629,6 +629,76 @@ func TestGnuCashTransactionDatabaseFileParseImportedData_ParseAmount(t *testing.
assert.Equal(t, int64(1234), allNewTransactions[0].Amount)
}
+func TestGnuCashTransactionDatabaseFileParseImportedData_ParseInvalidAmount(t *testing.T) {
+ converter := GnuCashTransactionDataImporter
+ context := core.NewNullContext()
+
+ user := &models.User{
+ Uid: 1234567890,
+ DefaultCurrency: "CNY",
+ }
+
+ _, _, _, _, _, _, err := converter.ParseImportedData(context, user, []byte(
+ gnucashCommonValidDataCaseHeader+
+ "\n"+
+ " \n"+
+ " 2024-09-01 12:34:56 +0000\n"+
+ " \n"+
+ " \n"+
+ " \n"+
+ " /\n"+
+ " 00000000000000000000000000001000\n"+
+ " \n"+
+ " \n"+
+ " /\n"+
+ " 00000000000000000000000000000010\n"+
+ " \n"+
+ " \n"+
+ "\n"+
+ gnucashCommonValidDataCaseFooter), 0, nil, nil, nil, nil, nil)
+ assert.EqualError(t, err, errs.ErrAmountInvalid.Message)
+
+ _, _, _, _, _, _, err = converter.ParseImportedData(context, user, []byte(
+ gnucashCommonValidDataCaseHeader+
+ "\n"+
+ " \n"+
+ " 2024-09-01 12:34:56 +0000\n"+
+ " \n"+
+ " \n"+
+ " \n"+
+ " 12345\n"+
+ " 00000000000000000000000000001000\n"+
+ " \n"+
+ " \n"+
+ " -12345\n"+
+ " 00000000000000000000000000000010\n"+
+ " \n"+
+ " \n"+
+ "\n"+
+ gnucashCommonValidDataCaseFooter), 0, nil, nil, nil, nil, nil)
+ assert.EqualError(t, err, errs.ErrAmountInvalid.Message)
+
+ _, _, _, _, _, _, err = converter.ParseImportedData(context, user, []byte(
+ gnucashCommonValidDataCaseHeader+
+ "\n"+
+ " \n"+
+ " 2024-09-01 12:34:56 +0000\n"+
+ " \n"+
+ " \n"+
+ " \n"+
+ " 12345/\n"+
+ " 00000000000000000000000000001000\n"+
+ " \n"+
+ " \n"+
+ " -12345/\n"+
+ " 00000000000000000000000000000010\n"+
+ " \n"+
+ " \n"+
+ "\n"+
+ gnucashCommonValidDataCaseFooter), 0, nil, nil, nil, nil, nil)
+ assert.EqualError(t, err, errs.ErrAmountInvalid.Message)
+}
+
func TestGnuCashTransactionDatabaseFileParseImportedData_ParseDescription(t *testing.T) {
converter := GnuCashTransactionDataImporter
context := core.NewNullContext()