"use strict"; const test = require("node:test"); const assert = require("node:assert/strict"); const fs = require("node:fs"); const path = require("node:path"); const foreignStock = require("../../Web/named-foreign-stock-restore-workflow.js"); const legacyRows = require("../../Web/legacy-named-row-workflow.js"); const namedPlaylists = require("../../Web/named-playlist-workflow.js"); 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 bridge = fs.readFileSync( path.join(root, "MainWindow.NamedForeignStockRestore.cs"), "utf8"); const namedBridge = fs.readFileSync(path.join(root, "MainWindow.NamedPlaylists.cs"), "utf8"); const core = fs.readFileSync( path.join(root, "src/MBN_STOCK_WEBVIEW.Core/Data/LegacyNamedForeignStockRestore.cs"), "utf8"); function rawRow(enabled = false) { return { itemIndex: 0, enabled, groupCode: "해외종목", subject: "NVIDIA", graphicType: "캔들그래프", subtype: "240일", pageText: "1/1", dataCode: "" }; } function materializedEntry() { const raw = rawRow(); const pending = foreignStock.classify(raw, { id: "db-foreign-stock-240", fadeDuration: 6, ma5: true, ma20: false }); const response = foreignStock.normalizeResponse({ requestId: "foreign-stock-load", retrievedAt: "2026-07-12T12:34:56+09:00", totalRowCount: 1, rows: [{ itemIndex: 0, status: "resolved", actionId: "stock-candle-240d", inputName: "NVIDIA", symbol: "NAS@NVDA", nationCode: "US", foreignDomesticCode: "1", builderKey: "s8010", cutCode: "8056", valueType: "PRICE", periodDays: 240 }] }, "foreign-stock-load", [pending]); return foreignStock.materialize(pending, response.rows[0]); } test("named load connects one correlated native foreign-stock restore batch end to end", () => { assert.match(index, /