feat: restore legacy named playlist workflows
This commit is contained in:
@@ -7,6 +7,7 @@ const stock = require("../../Web/operator-workflow.js");
|
||||
const fixed = require("../../Web/legacy-fixed-workflow.js");
|
||||
const industry = require("../../Web/industry-workflow.js");
|
||||
const overseas = require("../../Web/overseas-workflow.js");
|
||||
const namedForeignStock = require("../../Web/named-foreign-stock-restore-workflow.js");
|
||||
const tradingHalt = require("../../Web/trading-halt-workflow.js");
|
||||
|
||||
const adapters = { stock, fixed, industry, overseas, tradingHalt };
|
||||
@@ -35,6 +36,37 @@ const haltedStock = Object.freeze({
|
||||
function entries() {
|
||||
const fixedAction = fixed.actions.find(value => value.builderKey === "s8010" && value.available);
|
||||
const industryCut = industry.cuts.find(value => value.kind === "candle");
|
||||
const pendingNamedForeign = namedForeignStock.classify({
|
||||
itemIndex: 0,
|
||||
enabled: false,
|
||||
groupCode: "해외종목",
|
||||
subject: "NVIDIA",
|
||||
graphicType: "캔들그래프",
|
||||
subtype: "120일",
|
||||
pageText: "1/1",
|
||||
dataCode: ""
|
||||
}, options("named-overseas-candle"));
|
||||
const namedResponse = namedForeignStock.normalizeResponse({
|
||||
requestId: "named-overseas-load",
|
||||
retrievedAt: "2026-07-12T12:34:56+09:00",
|
||||
totalRowCount: 1,
|
||||
rows: [{
|
||||
itemIndex: 0,
|
||||
status: "resolved",
|
||||
actionId: "stock-candle-120d",
|
||||
inputName: "NVIDIA",
|
||||
symbol: "NAS@NVDA",
|
||||
nationCode: "US",
|
||||
foreignDomesticCode: "1",
|
||||
builderKey: "s8010",
|
||||
cutCode: "8051",
|
||||
valueType: "PRICE",
|
||||
periodDays: 120
|
||||
}]
|
||||
}, "named-overseas-load", [pendingNamedForeign]);
|
||||
const namedForeignEntry = namedForeignStock.materialize(
|
||||
pendingNamedForeign,
|
||||
namedResponse.rows[0]);
|
||||
return [
|
||||
stock.createStockPlaylistEntry(domesticStock, "candle-120d", options("stock-candle")),
|
||||
fixed.createFixedPlaylistEntry(fixedAction.id, options("fixed-candle")),
|
||||
@@ -46,6 +78,7 @@ function entries() {
|
||||
overseasStock,
|
||||
"stock-candle-120d",
|
||||
options("overseas-candle")),
|
||||
namedForeignEntry,
|
||||
tradingHalt.createTradingHaltPlaylistEntry(
|
||||
haltedStock,
|
||||
"candle-120d",
|
||||
@@ -61,13 +94,35 @@ test("global flags map to the exact closed candle graphic type", () => {
|
||||
assert.throws(() => workflow.expectedGraphicType("yes", true));
|
||||
});
|
||||
|
||||
test("all five original candle entry sources can be recreated with global flags", () => {
|
||||
test("all original and DB-restored candle entry sources can be recreated with global flags", () => {
|
||||
for (const entry of entries()) {
|
||||
const recreated = workflow.recreateCandleEntry(entry, true, true, adapters);
|
||||
assert.ok(recreated, entry.operator.source);
|
||||
assert.equal(recreated.selection.graphicType, "MA5,MA20");
|
||||
assert.deepEqual(recreated.operator.movingAverages, { ma5: true, ma20: true });
|
||||
assert.equal(recreated.enabled, entry.enabled);
|
||||
if (entry.operator.source === namedForeignStock.source) {
|
||||
assert.equal(recreated.operator.source, namedForeignStock.source);
|
||||
assert.deepEqual(recreated.operator.rawSelection, entry.operator.rawSelection);
|
||||
assert.ok(namedForeignStock.restorePlaylistEntry(recreated));
|
||||
assert.deepEqual(namedForeignStock.legacySelectionForEntry(recreated), {
|
||||
groupCode: "해외종목",
|
||||
subject: "NVIDIA",
|
||||
graphicType: "캔들그래프",
|
||||
subtype: "120일",
|
||||
dataCode: ""
|
||||
});
|
||||
assert.equal(namedForeignStock.matchesRaw(recreated, {
|
||||
itemIndex: 0,
|
||||
enabled: false,
|
||||
groupCode: "해외종목",
|
||||
subject: "NVIDIA",
|
||||
graphicType: "캔들그래프",
|
||||
subtype: "120일",
|
||||
pageText: "1/1",
|
||||
dataCode: ""
|
||||
}), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user