From 31df8b706cc8cae8cf063f923bba9fac8b775386 Mon Sep 17 00:00:00 2001 From: Peppa Date: Mon, 16 Nov 2026 15:19:23 +0500 Subject: [PATCH] =?UTF-8?q?DIK-21:=20=D1=82=D0=B5=D1=81=D1=82=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B2=D0=B5=D1=81=D1=8C=20=D1=81=D1=86=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B9=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=20(=D1=86=D0=B5=D0=BD=D0=B0,=20=D0=B0=D0=BA=D1=86=D0=B8=D1=8F,?= =?UTF-8?q?=20=D0=B4=D0=B0=D0=B2=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5,=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- test/lib.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/lib.test.js b/test/lib.test.js index 637d71d..b005c26 100644 --- a/test/lib.test.js +++ b/test/lib.test.js @@ -42,3 +42,20 @@ test("DIK-10: в списке есть дата проверки записи", const l = buildList([{ id: "a", name: "A", address: "x", lat: 51.1283, lng: 71.4305, checked: "2026-11-10", lunch: null, promo: null }], 51.1283, 71.4305, { now: new Date("2026-11-11T08:00:00Z") }); assert.equal(l[0].checked, "2026-11-10"); }); + +test("Сценарий: список с ценой и акцией, давние данные без цены, фильтр убирает пустые (DIK-21)", () => { + const vs = [ + { id: "ok", name: "OK", address: "x", lat: 51.1283, lng: 71.4305, checked: "2026-11-17", + lunch: { price: 2500, days: [1,2,3,4,5], from: "12:00", to: "15:00" }, promo: { text: "-10%", until: "2026-11-30" } }, + { id: "old", name: "Old", address: "y", lat: 51.1284, lng: 71.4305, checked: "2026-10-01", + lunch: { price: 2500, days: [1,2,3,4,5], from: "12:00", to: "15:00" }, promo: { text: "-10%", until: null } }, + { id: "gone", name: "Gone", address: "z", lat: 51.1285, lng: 71.4305, checked: "2026-11-17", lunch: null, promo: { text: "x", until: "2026-11-01" } }, + ]; + const all = buildList(vs, 51.1283, 71.4305, { now: wed13 }); + assert.deepEqual(all.map((v) => v.id), ["ok", "old", "gone"]); + assert.equal(all[0].lunch.price, 2500); + assert.equal(all[0].promo.text, "-10%"); + assert.equal(all[1].lunch, null); assert.equal(all[1].promo, null); assert.equal(all[1].unconfirmed, true); + assert.equal(all[2].promo, null); + assert.deepEqual(buildList(vs, 51.1283, 71.4305, { now: wed13, only: true }).map((v) => v.id), ["ok"]); +}); -- 2.45.2