diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-25 08:12:03 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-25 08:12:03 +0200 |
| commit | c35aa95081b994bf0d66d762945ad93bf501ff95 (patch) | |
| tree | b802969adbb9c6a5accf094d91883a036f92e506 | |
| parent | 5c22a35be47a10f85107107a9124ec401e6cd28d (diff) | |
tests
| -rw-r--r-- | TODO | 4 | ||||
| -rw-r--r-- | tests/peppol_write_tests.cpp | 20 | ||||
| -rw-r--r-- | tests/test_helper.cpp | 15 |
3 files changed, 34 insertions, 5 deletions
@@ -5,15 +5,17 @@ Refactor: Testing: - write tests for strops.hpp - write tests that check error handling for corrupt files. (e.g. references to tax rates, project and cost center that failed to load) -- peppol testing: add a billing item for each tax category. Improvements: +- Load all tax rates from all countries into new list, should be loaded before a file is imported. We can get rid of invoice_recalculate_totals after this. +- AI importer: query questions in batches and fill template in code - AI importer: all address data should be editable because import is not perfect - AI importer: file path should not be editable as it is imported - AI importer: real error logging for OpenAI and importing in general - AI importer: log elapsed time for ai requests Features: +- Handle invalid api key response from AI backends and display in settings UI - error log for tax report to display invoices not yet supported for tax generation or invoices with invalid tax rates - minimum invoice date for tax report generation, show warnings for unsupported invoices - create invoice PDF for NL https://goedestartbelastingdienst.nl/wiki/view/50bdccd8-f9a0-4297-b57f-3a6651cbe05c/factuureisen diff --git a/tests/peppol_write_tests.cpp b/tests/peppol_write_tests.cpp index d0bdee5..35cf940 100644 --- a/tests/peppol_write_tests.cpp +++ b/tests/peppol_write_tests.cpp @@ -17,8 +17,14 @@ TEST _peppol_write_nl2nl_b2b(void) inv.delivered_at = inv.issued_at; inv.expires_at = inv.issued_at + 1000; - administration::billing_item_add_to_invoice(&inv, _create_bi1()); - administration::billing_item_add_to_invoice(&inv, _create_bi2()); + administration::billing_item_add_to_invoice(&inv, _create_bix("Potato", 1, false, 10.0f, 0.0f, false, "NL/21")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Tomato", 3, false, 5.0f, 1.0f, false, "NL/9")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Banana", 5, false, 2.0f, 10.0f, true, "NL/9")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Guacamole", 1, false, 6.0f, 0.0f, true, "NL/0")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue", 1, false, 10.0f, 0.0f, false, "NL/BTV")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue 1", 1, false, 10.0f, 0.0f, false, "NL/BVB")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue 2", 1, false, 10.0f, 0.0f, false, "NL/PBEU")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue 3", 1, false, 10.0f, 0.0f, false, "NL/NBTW")); ASSERT_EQ(administration::invoice_add(&inv), A_ERR_SUCCESS); if (_test_peppol_file(inv.id)) { PASS(); } else { FAIL(); } @@ -39,8 +45,14 @@ TEST _peppol_write_nl2nl_b2c(void) inv.delivered_at = inv.issued_at; inv.expires_at = inv.issued_at + 1000; - administration::billing_item_add_to_invoice(&inv, _create_bi1()); - administration::billing_item_add_to_invoice(&inv, _create_bi2()); + administration::billing_item_add_to_invoice(&inv, _create_bix("Potato", 1, false, 10.0f, 0.0f, false, "NL/21")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Tomato", 3, false, 5.0f, 1.0f, false, "NL/9")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Banana", 5, false, 2.0f, 10.0f, true, "NL/9")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Guacamole", 1, false, 6.0f, 0.0f, true, "NL/0")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue", 1, false, 10.0f, 0.0f, false, "NL/BTV")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue 1", 1, false, 10.0f, 0.0f, false, "NL/BVB")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue 2", 1, false, 10.0f, 0.0f, false, "NL/PBEU")); + administration::billing_item_add_to_invoice(&inv, _create_bix("Glue 3", 1, false, 10.0f, 0.0f, false, "NL/NBTW")); ASSERT_EQ(administration::invoice_add(&inv), A_ERR_SUCCESS); if (_test_peppol_file(inv.id)) { PASS(); } else { FAIL(); } diff --git a/tests/test_helper.cpp b/tests/test_helper.cpp index ebc61a3..ff20ff8 100644 --- a/tests/test_helper.cpp +++ b/tests/test_helper.cpp @@ -151,6 +151,21 @@ static billing_item _create_bi6() return item; } +static billing_item _create_bix(char* name, float amount, bool aip, float npi, float discount, bool dip, char* taxrate) +{ + billing_item item = administration::billing_item_create_empty(); + item.amount = amount; + item.amount_is_percentage = aip; + strops::copy(item.description, name, MAX_LEN_LONG_DESC); + item.net_per_item = npi; + item.discount = discount; + item.discount_is_percentage = dip; + tax_rate rate; + administration::tax_rate_get_by_internal_code(&rate, taxrate); + strops::copy(item.tax_internal_code, rate.internal_code, MAX_LEN_SHORT_DESC); + return item; +} + static billing_item _create_bi(float amount, float npi, char* taxrate) { billing_item item = administration::billing_item_create_empty(); |
