// Pure unit tests for the estimate-classification helpers (no network). import { test } from 'node:test'; import assert from 'node:assert/strict'; import { isFreeEstimate, ladderAllFree } from '../dist/index.js'; test('isFreeEstimate: MaxTime 0 is a free window', () => { assert.equal(isFreeEstimate({ MaxTime: 0 }), true); assert.equal(isFreeEstimate({ MaxTime: '0' }), true); // API sends numbers as strings }); test('isFreeEstimate: positive MaxTime is a paid zone', () => { assert.equal(isFreeEstimate({ MaxTime: 33 }), false); assert.equal(isFreeEstimate({ MaxTime: '33' }), false); }); test('isFreeEstimate: missing/null MaxTime => no paid time => free', () => { assert.equal(isFreeEstimate({}), true); assert.equal(isFreeEstimate(null), true); assert.equal(isFreeEstimate(undefined), true); }); test('ladderAllFree: every rung $0.00 => true', () => { assert.equal(ladderAllFree([{ ParkingCost: '0.00' }, { ParkingCost: 0 }]), true); }); test('ladderAllFree: any priced rung => false', () => { assert.equal(ladderAllFree([{ ParkingCost: '0.00' }, { ParkingCost: '0.10' }]), false); }); test('ladderAllFree: empty ladder => false (nothing to conclude)', () => { assert.equal(ladderAllFree([]), false); });