DIK-21: тест на весь сценарий списка (цена, акция, давние данные, фильтр)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a689614d81
commit
31df8b706c
@ -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"]);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user