No description
Find a file
Hardik 48e1f19e58 test: add comprehensive tests for all new features + test plan
Parser extraction:
- Move parseSheet/parseWorkbook/cellStr/cellNum to lib/po-import-parser.ts
  so they can be unit-tested without HTTP overhead
- Route now re-exports types and delegates to the lib

Unit tests (165 total, all passing):
- permissions.test.ts: +15 cases covering MANAGER create_po/submit_po/
  manage_vendors, ACCOUNTS manage_vendors, AUDITOR all-denied, ADMIN
  operational denial, SUPERUSER no manage_vendors
- po-state-machine.test.ts: +12 cases covering MANAGER submit from DRAFT
  and EDITS_REQUESTED, ACCOUNTS provide_vendor_id, AUDITOR/ADMIN denied
  on all transitions
- po-import-parser.test.ts (new, 32 cases): cellStr/cellNum edge cases;
  parseSheet against real Sample_PO.xlsx (1 line item, correct values,
  T&C not included, vendor/quotation/T&C extraction); synthetic sheet
  edge cases (GST normalisation, INSTRUCTIONS stop, zero-price skip,
  empty rows); parseWorkbook happy path and empty-workbook

Integration tests (new files):
- discard-po.test.ts: owner/MANAGER/SUPERUSER can discard; ACCOUNTS and
  non-owners denied; status guard blocks non-DRAFT; cascade cleanup of
  POActions and POLineItems verified in DB
- vendor-approval.test.ts: approval blocked without vendor; approval
  succeeds with vendor; ACCOUNTS can provideVendorId; unverified vendor
  rejected; AUDITOR denied; wrong-status denied
- manager-po-creation.test.ts: MANAGER creates DRAFT and submits; stores
  correct submitterId; can discard own draft; ACCOUNTS denied; unauth
  returns Unauthorized
- products-search.test.ts: 401 unauth; min-length validation; search by
  name/code/description; case-insensitive; max 10 results; lastPrice as
  number; inactive products excluded
- import-api.test.ts: 401 unauth; 403 for TECHNICAL and ACCOUNTS; 400
  no file; 400 invalid binary; 200 for MANAGER with Sample_PO.xlsx;
  correct line item values; T&C absent from results; vendor/PI extracted

Spec/TEST_PLAN.md (new):
- Testing strategy, stack, and environment setup
- Coverage matrix across unit/integration/E2E layers
- Permission test matrix for all 7 roles × 15 operations
- Feature-level scenario index (F-01 through F-06) with IDs mapping to test files
- Known gaps and out-of-scope items
- Authoring conventions (PREFIX isolation, negative-first, no any)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 19:15:58 +05:30
App/pelagia-portal test: add comprehensive tests for all new features + test plan 2026-05-09 19:15:58 +05:30
.gitignore chore: initialize Next.js 15 project with Tailwind, TypeScript and tooling config 2026-05-05 23:23:43 +05:30