"use strict"; const test = require("node:test"); const assert = require("node:assert/strict"); const fs = require("node:fs"); const path = require("node:path"); const root = path.resolve(__dirname, "../.."); const app = fs.readFileSync(path.join(root, "Web/app.js"), "utf8"); const index = fs.readFileSync(path.join(root, "Web/index.html"), "utf8"); const styles = fs.readFileSync(path.join(root, "Web/styles.css"), "utf8"); const moduleSource = fs.readFileSync(path.join(root, "Web/market-nav-reorder.js"), "utf8"); test("market reorder module loads before app and binds only to marketNav", () => { const moduleIndex = index.indexOf(''); const appIndex = index.indexOf(''); assert.ok(moduleIndex >= 0 && appIndex > moduleIndex); assert.match(app, /const marketNavReorder = globalThis\.MbnMarketNavReorder;/u); assert.match(app, /marketNavReorder\.createController\(\{\s*nav: marketNav,/u); assert.match(app, /isBlocked: \(\) => hasOpenOperatorModal\(\) \|\| isPlaylistSnapshotLocked\(\)/u); assert.match(app, /if \(!marketNavReorderController\.mount\(\)\)/u); }); test("dashboard remains first and exactly ten original data-market identities reorder", () => { const nav = index.match(/