import { describe, expect, it } from 'vitest'; import { readFileSync } from 'node:fs'; import path from 'path'; import { weighInspectionNearTodaySql } from '../src/services/inspectionQueryService'; describe('称上待验今天±1天', () => { it('SQL 含上海日历 ±1 与配送日回退', () => { const sql = weighInspectionNearTodaySql('i'); expect(sql).toContain("TIME ZONE 'Asia/Shanghai'"); expect(sql).toContain('delivery_date'); expect(sql).toContain('::date - 1'); expect(sql).toContain('::date + 1'); }); it('INSPECTION_PENDING_WHERE 已挂近今日窗', () => { const src = readFileSync( path.join(__dirname, '../src/services/weighStationService.ts'), 'utf8' ); expect(src).toContain('weighInspectionNearTodaySql'); expect(src).toContain('INSPECTION_PENDING_WHERE'); }); // 原「设计文档存在」断言已移除:`20260910-weigh-inspection-near-today.md` 不在本仓库 // (git 历史亦无)。「今天±1」SQL 契约由上方用例直接钉住(T7 AC-T7.1.3)。 });