[object Object]

← back to Designer Wallcoverings

make cleaner importable (require.main guard + module.exports) + add _test_resolver.js — proves 12/13 colors resolve on sandbox (10 hardcoded, 2 via handle: red+pink); cream unresolved by design

88eb70011d0ad60d6754e2b7f52c3b8b12e0f612 · 2026-06-12 15:10:47 -0700 · Steve Abrams

Files touched

Diff

commit 88eb70011d0ad60d6754e2b7f52c3b8b12e0f612
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Jun 12 15:10:47 2026 -0700

    make cleaner importable (require.main guard + module.exports) + add _test_resolver.js — proves 12/13 colors resolve on sandbox (10 hardcoded, 2 via handle: red+pink); cream unresolved by design
---
 DW-Programming/_test_resolver.js              | 13 +++++++++++++
 DW-Programming/color-collection-cleaner-v2.js |  3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/DW-Programming/_test_resolver.js b/DW-Programming/_test_resolver.js
new file mode 100644
index 00000000..543ee68f
--- /dev/null
+++ b/DW-Programming/_test_resolver.js
@@ -0,0 +1,13 @@
+const { resolveCollectionId, COLOR_COLLECTIONS } = require('./color-collection-cleaner-v2.js');
+(async () => {
+  console.log('\n=== RESOLVER TEST (store = designer-laboratory-sandbox) ===\n');
+  let ok = 0, fail = 0;
+  for (const [color, cfg] of Object.entries(COLOR_COLLECTIONS)) {
+    const id = await resolveCollectionId(color, cfg);
+    if (!id) { console.log(`  [X] ${color.padEnd(8)} UNRESOLVED (hardcoded ${cfg.collectionId || 'null'})`); fail++; continue; }
+    const via = id === cfg.collectionId ? 'hardcoded id ' : 'handle lookup';
+    console.log(`  [OK] ${color.padEnd(8)} -> ${String(id).padEnd(14)} (${via})`);
+    ok++;
+  }
+  console.log(`\n  RESOLVED ${ok}/13   UNRESOLVED ${fail}/13\n`);
+})();
diff --git a/DW-Programming/color-collection-cleaner-v2.js b/DW-Programming/color-collection-cleaner-v2.js
index 8cd4dd5d..ac65a218 100644
--- a/DW-Programming/color-collection-cleaner-v2.js
+++ b/DW-Programming/color-collection-cleaner-v2.js
@@ -244,4 +244,5 @@ async function main() {
   console.log('\n===== SUMMARY ====='); sums.forEach(s => console.log(s));
   console.log(`\nLedger: ${LEDGER}\nBanner re-crawl queue: ${BANNER_QUEUE}`);
 }
-main().catch(console.error);
+module.exports = { resolveCollectionId, shopifyREST, fetchCollectionProducts, COLOR_COLLECTIONS, analyze };
+if (require.main === module) main().catch(console.error);

← df20fe8c add color-clean-report.js — per-color rollup (processed/remo  ·  back to Designer Wallcoverings  ·  color cleaner v2: (1) tri-state safety — removal now require df60b0ab →