Files
AutistMask/tests/applyEnrichment.test.js
T
sneak cc49b18c31
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
chore: bring the token-list enrichment tooling into script/lib (closes #495)
The two node programs and the data file from f7a2437 regenerate the name and
url of each token in src/shared/tokenList.js. They are now CommonJS under
script/lib/, find their files from their own location, and read
ethereum-lists at a pinned commit. The apply step also rewrites an entry that
already has a name and url, so it runs on the current list. It is exported as
applyEnrichment, and tests/applyEnrichment.test.js fails when the committed
list differs from what it writes from the committed data. make enrich-tokens
and make apply-enrichment run them. script/check-censored allows the MUSD
token's on-chain name in the data file.

Model: opus-5-5
2026-10-14 12:10:22 +00:00

20 lines
805 B
JavaScript

// The token names and URLs in src/shared/tokenList.js are written from
// script/lib/token-enrichment.json by script/lib/apply-enrichment.js
// (`make apply-enrichment`). The committed list must be exactly what it writes
// from the committed data, so the list, the data and the script cannot drift
// apart.
const fs = require("fs");
const path = require("path");
const enrichment = require("../script/lib/token-enrichment.json");
const { applyEnrichment } = require("../script/lib/apply-enrichment");
test("src/shared/tokenList.js is what make apply-enrichment writes from the committed data", () => {
const committed = fs.readFileSync(
path.join(__dirname, "..", "src/shared/tokenList.js"),
"utf8",
);
expect(applyEnrichment(committed, enrichment)).toBe(committed);
});