30 lines
1.4 KiB
JavaScript
30 lines
1.4 KiB
JavaScript
import test from "node:test";
|
||
import assert from "node:assert/strict";
|
||
import fs from "node:fs";
|
||
|
||
const app = fs.readFileSync("public/app.js", "utf8");
|
||
|
||
test("Сценарий: местоположение не отвечает — ожидание ограничено 10 секундами", () => {
|
||
assert.match(app, /timeout:\s*10000/);
|
||
});
|
||
|
||
test("Сценарий: рядом нет заведений — открывается выбор района и адреса", () => {
|
||
assert.match(app, /if \(far\) showManual\(\)/);
|
||
});
|
||
|
||
test("Тексты ожидания есть на трёх языках", () => {
|
||
for (const l of ["ru", "kk", "en"]) assert.ok(JSON.parse(fs.readFileSync(`public/i18n/${l}.json`, "utf8")).searching);
|
||
});
|
||
|
||
test("Сценарий: у каждого поля и кнопки без текста есть подпись на трёх языках", () => {
|
||
const html = fs.readFileSync("public/index.html", "utf8");
|
||
assert.doesNotMatch(html, /aria-label="Menu"/);
|
||
assert.match(html, /<label for="district"/);
|
||
assert.match(html, /<label for="addr"/);
|
||
assert.match(html, /id="burger" data-al="menuOpen"/);
|
||
for (const l of ["ru", "kk", "en"]) {
|
||
const d = JSON.parse(fs.readFileSync(`public/i18n/${l}.json`, "utf8"));
|
||
for (const k of ["menuOpen", "menuLabel", "districtLabel", "districtPlaceholder", "addressLabel"]) assert.ok(d[k], `${l}.${k}`);
|
||
}
|
||
});
|