fix: 解决本地分支不能登录

This commit is contained in:
sophie committed 2026-10-07 17:42:58 +08:00
1 parent fe5191b38a
commit abde3de71d
3 files changed
+129 -1

No files matched your search

@@ -0,0 +1,60 @@
/**
* features/contract-payment/utils/paymentStatus.test.ts
* 用途:锁定台账阶段格子的逾期与缺日期判定,避免验收款有过期日期却不显示已逾期。
* 依赖:paymentStatus.classifyLedgerStageCell。
* 逻辑:用固定业务日覆盖验收款已逾期、质保款未到期,以及零金额阶段显示为空格。
*/
import { describe, expect, it } from 'vitest';
import { classifyLedgerStageCell } from './paymentStatus';
const TODAY = '2026-10-07';
describe('classifyLedgerStageCell', () => {
it('marks an acceptance cell overdue when its date is before today', () => {
// 验收款没有付款回写,仍要按日期依据标已逾期,和预付款、出货款同一套比较。
expect(classifyLedgerStageCell({
status: 'active',
percentage: '30',
amount: '6600.00',
due_date: '2026-09-30',
anchor_date: '2026-09-30',
}, 'acceptance', TODAY)).toBe('overdue');
});
it('marks a future warranty date as not yet due', () => {
expect(classifyLedgerStageCell({
status: 'active',
percentage: '10',
amount: '2200.00',
due_date: '2027-09-25',
anchor_date: '2026-09-30',
}, 'warranty', TODAY)).toBe('active');
});
it('asks for a stage-specific missing-date label when acceptance has no archive date', () => {
expect(classifyLedgerStageCell({
status: 'active',
percentage: '35',
amount: '52500.00',
due_date: null,
anchor_date: null,
}, 'acceptance', TODAY)).toBe('missing_date');
});
it('keeps paid prepayment as paid and a zero stage as an empty cell', () => {
expect(classifyLedgerStageCell({
status: 'paid',
percentage: '30',
amount: '6600.00',
due_date: '2026-08-12',
anchor_date: '2026-08-12',
}, 'prepayment', TODAY)).toBe('paid');
expect(classifyLedgerStageCell({
status: 'active',
percentage: '0',
amount: '0',
due_date: null,
anchor_date: null,
}, 'acceptance', TODAY)).toBe('absent');
});
});