38 lines
1015 B
JavaScript
38 lines
1015 B
JavaScript
const fs = require("fs");
|
|
|
|
const commonUtil = fs.readFileSync("utils/CommonUtil.js", "utf8");
|
|
|
|
function assert(condition, message) {
|
|
if (!condition) {
|
|
throw new Error(message);
|
|
}
|
|
}
|
|
|
|
assert(
|
|
/installCaiSingleLotteryMode\(\)\s*\{[\s\S]*#lotteryFilter[\s\S]*closest\('\.cxz-filter-row'\)\.hide\(\);/.test(
|
|
commonUtil,
|
|
),
|
|
"CommonUtil should hide the inner lottery filter row on cai.html",
|
|
);
|
|
|
|
assert(
|
|
/installCaiSingleLotteryMode\(\)\s*\{[\s\S]*ApiClient\.loadMenuCompat\(\)[\s\S]*topbar__nav-link/.test(
|
|
commonUtil,
|
|
),
|
|
"CommonUtil should render lottery switching into the top navigation",
|
|
);
|
|
|
|
assert(
|
|
/activeClass\s*=\s*String\(code\)\s*===\s*currentCode[\s\S]*topbar__nav-link'\s*\+\s*activeClass/.test(
|
|
commonUtil,
|
|
),
|
|
"CommonUtil top navigation should mark current lottery active",
|
|
);
|
|
|
|
assert(
|
|
/this\.installCaiSingleLotteryMode\(\);/.test(commonUtil),
|
|
"CommonUtil.loadPageConfig should install cai single-lottery mode",
|
|
);
|
|
|
|
console.log("cai single-lottery checks passed");
|