Commit Graph

8 Commits

Author SHA1 Message Date
d9d9263824 test(admin): complete remaining admin behavior tests
Add tests for:
- Background jobs: ECS filtering, job start prevention, ECS launch (21.3, 22.4, 22.5)
- History: invalid entity ID, date formatting, nil values, inline history, no pagination, inspector recursion (23.2, 24.2, 24.4, 24.5, 24.7, 25.2)
- Import batches: date/source filtering, sorting, pagination (27.1, 27.2, 28.1, 28.2)
- Excel invoices: parsing, client/vendor/account resolution, grouping, cash/non-cash invoices (30.1-30.7)
- Sales summaries: date filtering, client scoping, account typeahead, credit/debit validation, save behavior (32.1, 32.2, 33.5, 33.7-33.9)
- Cross-cutting: admin access control, audit history, impersonation, form validation, Solr indexing (34.1-38.2)

All 48 admin tests passing with 345 assertions.
2026-05-07 01:48:20 -07:00
ddbb6abc3a test(admin): implement integration and unit tests for admin behaviors
Implement comprehensive test coverage for admin dashboard behaviors:
- Dashboard access control (2.1, 2.2)
- Client filtering by name, code, group (4.1-4.5)
- Client sorting and pagination (5.1-5.3)
- Client wizard validation (6.12, 6.17, 6.18, 6.20)
- Account filtering, sorting, and dialog validation (9.1-11.9)
- Vendor filtering and wizard validation (13.1-14.12)
- Vendor merge validation (15.2, 15.3)
- Transaction rule filtering, wizard, execution, and deletion (17.1-20.3)

Also fixes vendor terms override duplicate validation in vendors.clj.
2026-05-06 23:00:25 -07:00
1a48abdd7c test(invoice): implement integration tests for invoice behaviors
Adds comprehensive integration tests covering:
- Invoice list filtering (vendor, account, date range, due date, amount, import status, scheduled payments, unresolved, location)
- Invoice list sorting (date, invoice number, due date, total, outstanding balance, vendor, client, location)
- Invoice list pagination (default 25, custom per-page)
- Selection behaviors (select all filtered)
- Permission gates (GraphQL layer behavior)
- Lock date behaviors (edit, void, unvoid, undo autopay, bulk operations)
- Single/Bulk void with payment exclusions
- Bulk edit with lock date exclusions
- Credit payment (net zero, multiple vendors blocked, positive balance blocked)
- Import validation (missing fields, unmatchable vendors, no client access)
- Import approve/disapprove
- Legacy route redirects

Updates docs/testing/behaviors/invoice.md with 76 completed behavior markers.

57 tests, 99 assertions, all passing.
2026-05-05 05:00:51 -07:00
ececdc8f5f 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
2026-05-04 23:10:46 -07:00
da7897c0d6 test(invoice): implement unit tests for invoice behaviors
Add comprehensive unit tests for pure invoice business logic:
- assert-invoice-amounts-add-up (behaviors 9.4, 11.4)
- does-amount-exceed-outstanding? (behavior 13.4)
- assert-percentages-add-up (behavior 15.3)
- stack-rank and deduplicate (behaviors 24.1, 24.4, 24.5)
- clientize-vendor (behavior 8.4)
- location-select* (behavior 9.3)
- maybe-code-accounts with Shared location spreading (behavior 15.6)
- can-undo-autopayment (behaviors 19.2-19.4)
- due date / scheduled payment calculations (behaviors 8.2, 8.3)
- can-handwrite? and credit-only? (pay wizard behaviors)
- due date display logic (behavior 1.7)

Also fixes:
- user.clj: add missing datomic.api alias (d) used in sample functions
- new_invoice_wizard_test.clj: fix sut8 -> sut9 typo

Marks completed unit-test behaviors with [x] in invoice.md
2026-05-04 21:29:40 -07:00
d627e3c5d0 refactor(all): rewrite all behavior docs in table format with checkboxes
Rewrite all 11 remaining behavior documents to match the streamlined
invoice.md format:

- dashboard.md: 250 lines, 62 behaviors
- payment.md: 260 lines, behaviors for list, void, check printing, ACH
- transaction.md: 310 lines, list, import, admin insights
- ledger.md: 519 lines, entries, P&L, balance sheet, cash flows
- company.md: 320 lines, profile, 1099s, Plaid/Yodlee, reports
- admin.md: 494 lines, clients, accounts, vendors, rules, jobs, history
- pos.md: 405 lines, sales, deposits, tenders, refunds, shifts
- search-indicators.md: 167 lines, search modal, indicators
- auth.md: 184 lines, login, logout, impersonation, sessions
- outgoing-invoice.md: 192 lines, create, line items, PDF
- legacy-spa.md: 340 lines, all legacy pages (docs only)

All documents now use:
- Testing Patterns section with reusable abstractions
- Numbered tables: # | Behavior | Test Strategy | Status
- It should... behavior descriptions
- Checkboxes [ ]/[x] for tracking implementation
- Cross-Cutting Behaviors for permissions, lock dates, etc.
- Test Data Requirements tables
- Existing Tests to Preserve sections

Total: 3,844 lines of behavior documentation across 12 subsystem docs.
2026-05-04 13:48:51 -07:00
e14a23ff54 refactor(invoice): rewrite in table format with test strategies and checkboxes
- Add testing patterns section (Grid Page, Wizard, Permission Gates)
- Convert all behaviors to numbered tables with checkboxes
- Specify test strategy per behavior (Unit/Integration/UI)
- Group by feature area: Display, Filter, Sort, Pay Wizard, etc.
- Add cross-cutting Permissions and Lock Date tables
- Reduce from 496 to 403 lines while being more comprehensive
2026-05-04 13:31:02 -07:00
b499d460f3 docs: add comprehensive test behavior documentation for all pages
Add behavior documentation covering all SSR and legacy SPA pages:
- Testing strategy and type definitions (unit/integration/UI)
- Dashboard, Invoice, Payment, Transaction, Ledger pages
- Company/Settings, POS, Admin, Search, Auth pages
- Legacy SPA behavior docs (no UI tests until migrated)
- Edge cases, test data requirements, and dependencies per subsystem

Total: 3,600+ lines of behavior documentation to guide test authorship.
2026-05-04 12:15:20 -07:00