mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 09:52:27 +00:00
fix(limits): keep bracket-access reads in numeric-limit discovery
A quoted name after an identifier, call, or optional chain is a producer. Only declaration arrays and comments stay out of discovery.
This commit is contained in:
1 parent
f2d55aba7b
commit
7fe465505f
2 files changed
+59
-2
No files matched your search
@@ -41,6 +41,17 @@ it("does not treat a registry declaration as a producer", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps a bracket-access read as a producer", () => {
|
||||
const name = "REA_NEW_MAX_BYTES";
|
||||
const discovered = discoverNumericLimitUses([
|
||||
{
|
||||
path: "src/config/newLimit.ts",
|
||||
source: `const selected = environment["${name}"] ?? environment?.[ "${name}" ];`,
|
||||
},
|
||||
]);
|
||||
expect(discovered.get(name)).toBe("src/config/newLimit.ts");
|
||||
});
|
||||
|
||||
it("does not treat a registration allowlist or a comment as a producer", () => {
|
||||
const discovered = discoverNumericLimitUses([
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user