fix: reject invalid dates in analytics

This commit is contained in:
2026-09-06 16:28:17 +03:00
parent d00177ccc8
commit 5a4371f5ed
3 changed files with 14 additions and 2 deletions
+6 -1
View File
@@ -1,6 +1,11 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {companyStats} from '../src/services/analytics.js';
import {companyStats,parseDateTR} from '../src/services/analytics.js';
test('analytics rejects impossible Turkish calendar dates instead of rolling them over',()=>{
assert.equal(parseDateTR('31.02.2026'),null);
assert.equal(parseDateTR('29.02.2028')?.getDate(),29);
assert.equal(parseDateTR('30/04/2026')?.getMonth(),3);
});
import {hizliFiltreGecer} from '../src/services/ihaleTarih.js';
import {applyTenderStates} from '../src/services/tenderState.js';
test('review counter uses the same explicit state as reviewed and unread filters',()=>{