PSA/packages/billing/tests/multiActiveContracts.singletonGuardRemoval.wiring.test.ts
Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

68 lines
3.2 KiB
TypeScript

import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const wizardBasicsSource = readFileSync(
new URL('../src/components/billing-dashboard/contracts/wizard-steps/ContractBasicsStep.tsx', import.meta.url),
'utf8'
);
const contractDialogSource = readFileSync(
new URL('../src/components/billing-dashboard/contracts/ContractDialog.tsx', import.meta.url),
'utf8'
);
const clientContractsTabSource = readFileSync(
new URL('../src/components/billing-dashboard/contracts/ClientContractsTab.tsx', import.meta.url),
'utf8'
);
const contractsShellSource = readFileSync(
new URL('../src/components/billing-dashboard/contracts/Contracts.tsx', import.meta.url),
'utf8'
);
const contractActionsSource = readFileSync(
new URL('../src/actions/contractActions.ts', import.meta.url),
'utf8'
);
const contractModelSource = readFileSync(
new URL('../src/models/contract.ts', import.meta.url),
'utf8'
);
const sharedContractsSource = readFileSync(
new URL('../../../shared/billingClients/contracts.ts', import.meta.url),
'utf8'
);
describe('Multi-active contracts singleton blocker removal wiring', () => {
it('T005/T007: wizard basics does not disable clients or show singleton warning copy', () => {
expect(wizardBasicsSource).not.toContain('disabledClientIds');
expect(wizardBasicsSource).not.toContain('fetchClientIdsWithActiveContracts');
expect(wizardBasicsSource).not.toContain('checkClientHasActiveContract');
expect(wizardBasicsSource).not.toContain('This client already has an active contract');
});
it('T006/T008: quick add/edit dialog does not gate on sibling active contracts', () => {
expect(contractDialogSource).not.toContain('disabledClientIds');
expect(contractDialogSource).not.toContain('fetchClientIdsWithActiveContracts');
expect(contractDialogSource).not.toContain('checkClientHasActiveContract');
expect(contractDialogSource).not.toContain('clientHasActiveContract');
expect(contractDialogSource).toContain('disabled={!contractName.trim() || !clientId}');
});
it('T009/T010/T011: activation flows no longer run singleton prechecks in either contracts tab shell', () => {
expect(clientContractsTabSource).not.toContain('checkClientHasActiveContract');
expect(contractsShellSource).not.toContain('checkClientHasActiveContract');
});
it('T013/T014/T015/T016: action/shared layers no longer encode singleton active-contract blockers', () => {
expect(contractActionsSource).not.toContain('checkClientHasActiveContract');
expect(contractActionsSource).not.toContain('fetchClientIdsWithActiveContracts');
expect(contractActionsSource).not.toContain('Client already has an active contract');
expect(sharedContractsSource).not.toContain('hasActiveContractForClient');
expect(sharedContractsSource).not.toContain('getClientIdsWithActiveContracts');
expect(sharedContractsSource).not.toContain('terminate their current active contract first');
});
it('T017: billing contract model no longer carries singleton helper wrappers', () => {
expect(contractModelSource).not.toContain('hasActiveContractForClient: async');
expect(contractModelSource).not.toContain('getClientIdsWithActiveContracts: async');
});
});