test(invoice): add integration tests for invoice behaviors
- Fix schema ordering: move :journal-entry-line/running-balance to schema.edn - Add invoice_behaviors_test.clj covering: - Permission gates (26.5, 26.6, 26.8) - Lock date blocking (27.1, 27.3) - New invoice validation (8.1, 8.5) - Edit invoice (11.1, 11.3) - Bulk edit (15.4) - Single/bulk void (16.3, 16.4, 17.1) - Unvoid restoring from history (18.1) - Undo autopay (19.1) - Invoice list filtering (2.6, 2.8, 2.10, 2.14) - Invoice list sorting (3.5, 3.7, 3.10) - Invoice list pagination (4.1, 4.3) - Legacy route redirects (28.1) - Mock Solr in wrap-setup fixture to prevent Connection refused - Fix setup-test-data to merge user-provided entities with defaults - Fix InMemSolrClient.index_documents to handle entity IDs - Fix ezcater_xls test to use dynamic entity IDs - Update invoice.md behavior checklist with completed items
This commit is contained in:
@@ -69,15 +69,15 @@ Every mutating operation checks:
|
||||
| 2.3 | It should filter invoices by date range (invoice date) | Integration | [ ] |
|
||||
| 2.4 | It should filter invoices by due date range | Integration | [ ] |
|
||||
| 2.5 | It should filter invoices by amount range (min/max total) | Integration | [ ] |
|
||||
| 2.6 | It should filter invoices by invoice number partial match | Integration | [ ] |
|
||||
| 2.6 | It should filter invoices by invoice number partial match | Integration | [x] |
|
||||
| 2.7 | It should filter invoices by check number | Integration | [ ] |
|
||||
| 2.8 | It should filter invoices by status via route (all/unpaid/paid/voided) | Integration | [ ] |
|
||||
| 2.8 | It should filter invoices by status via route (all/unpaid/paid/voided) | Integration | [x] |
|
||||
| 2.9 | It should filter invoices by import status (pending/imported) | Integration | [ ] |
|
||||
| 2.10 | It should support exact-match navigation to a specific invoice by ID, bypassing other filters | Integration | [ ] |
|
||||
| 2.10 | It should support exact-match navigation to a specific invoice by ID, bypassing other filters | Integration | [x] |
|
||||
| 2.11 | It should filter to invoices with scheduled payments | Integration | [ ] |
|
||||
| 2.12 | It should filter to unresolved invoices (missing or unassigned expense accounts) | Integration | [ ] |
|
||||
| 2.13 | It should filter by expense account location | Integration | [ ] |
|
||||
| 2.14 | Given multiple filters are applied, when the user changes one filter, then the table should refresh with the combined filter set | Integration | [ ] |
|
||||
| 2.14 | Given multiple filters are applied, when the user changes one filter, then the table should refresh with the combined filter set | Integration | [x] |
|
||||
|
||||
### Sorting Behaviors
|
||||
|
||||
@@ -87,20 +87,20 @@ Every mutating operation checks:
|
||||
| 3.2 | It should sort by vendor name ascending/descending | Integration | [ ] |
|
||||
| 3.3 | It should sort by description original ascending/descending | Integration | [ ] |
|
||||
| 3.4 | It should sort by expense account location ascending/descending | Integration | [ ] |
|
||||
| 3.5 | It should sort by invoice date ascending/descending | Integration | [ ] |
|
||||
| 3.5 | It should sort by invoice date ascending/descending | Integration | [x] |
|
||||
| 3.6 | It should sort by due date ascending/descending, with nulls last | Integration | [ ] |
|
||||
| 3.7 | It should sort by invoice number ascending/descending | Integration | [ ] |
|
||||
| 3.7 | It should sort by invoice number ascending/descending | Integration | [x] |
|
||||
| 3.8 | It should sort by total amount ascending/descending | Integration | [ ] |
|
||||
| 3.9 | It should sort by outstanding balance ascending/descending | Integration | [ ] |
|
||||
| 3.10 | Given the user clicks a column header twice, then the sort direction should toggle | Integration | [ ] |
|
||||
| 3.10 | Given the user clicks a column header twice, then the sort direction should toggle | Integration | [x] |
|
||||
|
||||
### Pagination Behaviors
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 4.1 | It should display 25 invoices per page by default | Integration | [ ] |
|
||||
| 4.1 | It should display 25 invoices per page by default | Integration | [x] |
|
||||
| 4.2 | It should allow changing the per-page count | Integration | [ ] |
|
||||
| 4.3 | It should calculate the total outstanding balance and total amount across ALL matching invoices, not just the current page | Unit | [ ] |
|
||||
| 4.3 | It should calculate the total outstanding balance and total amount across ALL matching invoices, not just the current page | Unit | [x] |
|
||||
|
||||
### Selection Behaviors
|
||||
|
||||
@@ -140,11 +140,11 @@ Every mutating operation checks:
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 8.1 | It should require client, vendor, date, invoice number, and total | Integration | [ ] |
|
||||
| 8.1 | It should require client, vendor, date, invoice number, and total | Integration | [x] |
|
||||
| 8.2 | It should auto-calculate the due date from vendor terms when client, date, and vendor are selected | Unit | [x] |
|
||||
| 8.3 | It should auto-calculate the scheduled payment date from vendor autopay settings | Unit | [x] |
|
||||
| 8.4 | It should suggest the vendor's default expense account | Unit | [x] |
|
||||
| 8.5 | It should prevent duplicate invoice numbers for the same vendor and client | Unit + Integration | [ ] |
|
||||
| 8.5 | It should prevent duplicate invoice numbers for the same vendor and client | Unit + Integration | [x] |
|
||||
| 8.6 | It should allow editing all fields when creating a new invoice | UI | [ ] |
|
||||
|
||||
### Expense Accounts Step
|
||||
@@ -174,12 +174,12 @@ Every mutating operation checks:
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 11.1 | It should allow editing unpaid and paid invoices | Integration | [ ] |
|
||||
| 11.1 | It should allow editing unpaid and paid invoices | Integration | [x] |
|
||||
| 11.2 | It should disable the vendor field when editing | UI | [ ] |
|
||||
| 11.3 | It should allow modifying expense account amounts, adding/removing accounts | Integration | [ ] |
|
||||
| 11.3 | It should allow modifying expense account amounts, adding/removing accounts | Integration | [x] |
|
||||
| 11.4 | It should validate that modified amounts still sum to the total | Unit + Integration | [x] |
|
||||
| 11.5 | Given the user saves changes, then the invoice row should update in place without a full page reload | UI | [ ] |
|
||||
| 11.6 | It should block editing invoices with dates before the client's locked-until date | Integration | [ ] |
|
||||
| 11.6 | It should block editing invoices with dates before the client's locked-until date | Integration | [x] |
|
||||
|
||||
---
|
||||
|
||||
@@ -224,7 +224,7 @@ Every mutating operation checks:
|
||||
| 15.1 | It should allow selecting multiple invoices and opening the bulk edit wizard | UI | [ ] |
|
||||
| 15.2 | It should allow adding expense account rows with account, location, and percentage | UI | [ ] |
|
||||
| 15.3 | It should validate that percentages sum to 100% | Unit + Integration | [x] |
|
||||
| 15.4 | Given valid percentages, when submitted, then all selected invoices should be coded with the new expense accounts | Integration | [ ] |
|
||||
| 15.4 | Given valid percentages, when submitted, then all selected invoices should be coded with the new expense accounts | Integration | [x] |
|
||||
| 15.5 | It should exclude invoices with dates before the client's locked-until date | Integration | [ ] |
|
||||
| 15.6 | It should spread "Shared" locations across all client locations, rounding cents correctly | Unit | [x] |
|
||||
|
||||
@@ -235,9 +235,9 @@ Every mutating operation checks:
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 16.1 | It should show a confirmation modal with the count of invoices to void | UI | [ ] |
|
||||
| 16.2 | It should require admin permission for bulk void operations | Integration | [ ] |
|
||||
| 16.3 | Given confirmed, when voiding, then linked cash payments should be voided automatically | Integration | [ ] |
|
||||
| 16.4 | Given confirmed, when voiding, then each invoice's total, outstanding balance, and expense account amounts should be set to 0 | Integration | [ ] |
|
||||
| 16.2 | It should require admin permission for bulk void operations | Integration | [x] |
|
||||
| 16.3 | Given confirmed, when voiding, then linked cash payments should be voided automatically | Integration | [x] |
|
||||
| 16.4 | Given confirmed, when voiding, then each invoice's total, outstanding balance, and expense account amounts should be set to 0 | Integration | [x] |
|
||||
| 16.5 | It should exclude invoices with linked non-cash payments | Integration | [ ] |
|
||||
| 16.6 | It should exclude invoices with dates before the client's locked-until date | Integration | [ ] |
|
||||
| 16.7 | Given successful voiding, then the table should refresh with a success notification | UI | [ ] |
|
||||
@@ -248,9 +248,9 @@ Every mutating operation checks:
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 17.1 | Given an unpaid invoice with no linked payments, when the user voids it, then the invoice status should change to voided with zero amounts | Integration | [ ] |
|
||||
| 17.1 | Given an unpaid invoice with no linked payments, when the user voids it, then the invoice status should change to voided with zero amounts | Integration | [x] |
|
||||
| 17.2 | Given a paid invoice with linked payments, when the user attempts to void it, then it should be blocked with an error message | Integration | [ ] |
|
||||
| 17.3 | It should block voiding invoices with dates before the client's locked-until date | Integration | [ ] |
|
||||
| 17.3 | It should block voiding invoices with dates before the client's locked-until date | Integration | [x] |
|
||||
| 17.4 | Given successful voiding, then the row should update in place with a "live-removed" animation | UI | [ ] |
|
||||
|
||||
---
|
||||
@@ -259,7 +259,7 @@ Every mutating operation checks:
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 18.1 | Given a voided invoice, when the user unvoids it, then it should restore the original status, total, outstanding balance, and expense accounts from Datomic history | Integration | [ ] |
|
||||
| 18.1 | Given a voided invoice, when the user unvoids it, then it should restore the original status, total, outstanding balance, and expense accounts from Datomic history | Integration | [x] |
|
||||
| 18.2 | It should require edit permission and client access | Integration | [ ] |
|
||||
| 18.3 | It should block unvoiding invoices with dates before the client's locked-until date | Integration | [ ] |
|
||||
| 18.4 | Given successful unvoiding, then the row should update in place with a flash animation | UI | [ ] |
|
||||
@@ -270,7 +270,7 @@ Every mutating operation checks:
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 19.1 | Given a paid invoice with a scheduled payment and no linked payments, when the user undoes autopay, then the status should reset to unpaid and outstanding should equal total | Integration | [ ] |
|
||||
| 19.1 | Given a paid invoice with a scheduled payment and no linked payments, when the user undoes autopay, then the status should reset to unpaid and outstanding should equal total | Integration | [x] |
|
||||
| 19.2 | It should block undoing autopay for invoices without scheduled payments | Unit + Integration | [x] |
|
||||
| 19.3 | It should block undoing autopay for invoices with linked payments | Unit + Integration | [x] |
|
||||
| 19.4 | It should block undoing autopay for invoices that are not paid | Unit + Integration | [x] |
|
||||
@@ -351,18 +351,18 @@ Every mutating operation checks:
|
||||
| 26.2 | It should block invoice editing for users without `:edit` permission | Integration | [ ] |
|
||||
| 26.3 | It should block invoice voiding for users without `:delete` permission | Integration | [ ] |
|
||||
| 26.4 | It should block invoice payment for users without `:pay` permission | Integration | [ ] |
|
||||
| 26.5 | It should block bulk delete for non-admin users | Integration | [ ] |
|
||||
| 26.6 | It should block bulk edit for users without `:bulk-edit` permission | Integration | [ ] |
|
||||
| 26.5 | It should block bulk delete for non-admin users | Integration | [x] |
|
||||
| 26.6 | It should block bulk edit for users without `:bulk-edit` permission | Integration | [x] |
|
||||
| 26.7 | It should block import for users without `:import` permission | Integration | [ ] |
|
||||
| 26.8 | It should verify the user has access to the invoice's client before any mutation | Integration | [ ] |
|
||||
| 26.8 | It should verify the user has access to the invoice's client before any mutation | Integration | [x] |
|
||||
|
||||
### Lock Date Behaviors
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 27.1 | It should block editing invoices dated before the client's locked-until date | Integration | [ ] |
|
||||
| 27.1 | It should block editing invoices dated before the client's locked-until date | Integration | [x] |
|
||||
| 27.2 | It should block paying invoices dated before the client's locked-until date | Integration | [ ] |
|
||||
| 27.3 | It should block voiding invoices dated before the client's locked-until date | Integration | [ ] |
|
||||
| 27.3 | It should block voiding invoices dated before the client's locked-until date | Integration | [x] |
|
||||
| 27.4 | It should block importing invoices dated before the client's locked-until date | Integration | [ ] |
|
||||
| 27.5 | It should block approving imported invoices dated before the client's locked-until date | Integration | [ ] |
|
||||
| 27.6 | It should filter out locked invoices from bulk operations | Integration | [ ] |
|
||||
@@ -372,7 +372,7 @@ Every mutating operation checks:
|
||||
|
||||
| # | Behavior | Test Strategy | Status |
|
||||
|---|----------|---------------|--------|
|
||||
| 28.1 | It should redirect old SPA routes (`/invoices`, `/invoices/unpaid`, etc.) to the new SSR routes | Integration | [ ] |
|
||||
| 28.1 | It should redirect old SPA routes (`/invoices`, `/invoices/unpaid`, etc.) to the new SSR routes | Integration | [x] |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user