Title: fix: InvoiceStatus enum missing PENDING value causes test suite failure
Labels: bug, backend, testing, priority-high
Description:
The invoice service test suite fails to run due to a TypeScript
error. The test file references InvoiceStatus.PENDING but this
value does not exist on the InvoiceStatus enum. This causes the
entire test suite to fail at compile time before any test can
execute.
Error:
src/invoice/invoices.service.spec.ts:43:223 - error TS2339:
Property 'PENDING' does not exist on type 'typeof InvoiceStatus'.
This is a critical bug because it means invoice service tests
are not running at all, leaving the invoice creation flow
completely untested.
What Needs to Be Done:
Option A — Add PENDING to the InvoiceStatus enum (preferred):
- Open the InvoiceStatus enum definition
(likely in src/invoice/invoice.entity.ts or
src/invoice/enums/invoice-status.enum.ts)
- Add PENDING as a valid status value:
export enum InvoiceStatus {
PENDING = 'PENDING',
DRAFT = 'DRAFT',
SUBMITTED = 'SUBMITTED',
FINANCED = 'FINANCED',
PAID = 'PAID',
DEFAULTED = 'DEFAULTED',
}
- Verify PENDING is the correct initial status for
newly created invoices
Option B — Fix the test to use the correct existing status:
- If the enum intentionally has no PENDING value and
DRAFT is the correct initial status, update the test
to use InvoiceStatus.DRAFT instead of InvoiceStatus.PENDING
- Update both occurrences in invoices.service.spec.ts:
Line 43: status: InvoiceStatus.DRAFT
Line 50: status: InvoiceStatus.DRAFT
Whichever option is chosen must be consistent — the enum
definition and the test must agree on what the initial
invoice status is.
Key Files:
- src/invoice/invoice.entity.ts (likely enum location)
- src/invoice/enums/invoice-status.enum.ts (if separate file)
- src/invoice/invoices.service.spec.ts (lines 43 and 50)
- src/invoice/invoices.service.ts (verify default status used)
Acceptance Criteria:
- npm run test runs without TypeScript compilation errors
- invoices.service.spec.ts test suite passes fully
- InvoiceStatus enum is consistent across entity,
service, and test files
- No other files reference InvoiceStatus.PENDING if
PENDING is not added to the enum
- If PENDING is added, the invoice creation service
uses PENDING as the default status on new invoices
- All existing passing tests continue to pass
Branch: fix/invoice-status-pending-enum
Commit: fix(invoice): add PENDING status to InvoiceStatus enum and fix failing test suite
Title: fix: InvoiceStatus enum missing PENDING value causes test suite failure
Labels: bug, backend, testing, priority-high
Description:
The invoice service test suite fails to run due to a TypeScript
error. The test file references InvoiceStatus.PENDING but this
value does not exist on the InvoiceStatus enum. This causes the
entire test suite to fail at compile time before any test can
execute.
Error:
src/invoice/invoices.service.spec.ts:43:223 - error TS2339:
Property 'PENDING' does not exist on type 'typeof InvoiceStatus'.
This is a critical bug because it means invoice service tests
are not running at all, leaving the invoice creation flow
completely untested.
What Needs to Be Done:
Option A — Add PENDING to the InvoiceStatus enum (preferred):
(likely in src/invoice/invoice.entity.ts or
src/invoice/enums/invoice-status.enum.ts)
export enum InvoiceStatus {
PENDING = 'PENDING',
DRAFT = 'DRAFT',
SUBMITTED = 'SUBMITTED',
FINANCED = 'FINANCED',
PAID = 'PAID',
DEFAULTED = 'DEFAULTED',
}
newly created invoices
Option B — Fix the test to use the correct existing status:
DRAFT is the correct initial status, update the test
to use InvoiceStatus.DRAFT instead of InvoiceStatus.PENDING
Line 43: status: InvoiceStatus.DRAFT
Line 50: status: InvoiceStatus.DRAFT
Whichever option is chosen must be consistent — the enum
definition and the test must agree on what the initial
invoice status is.
Key Files:
Acceptance Criteria:
service, and test files
PENDING is not added to the enum
uses PENDING as the default status on new invoices
Branch: fix/invoice-status-pending-enum
Commit: fix(invoice): add PENDING status to InvoiceStatus enum and fix failing test suite