mirror of
https://github.com/morluto/rea.git
synced 2026-10-29 19:05:45 +00:00
fix(javascript): avoid invented computed destructuring properties (#507)
Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
This commit is contained in:
1 parent
2fd11961cf
commit
80777d96da
3 files changed
+46
-2
No files matched your search
@@ -170,6 +170,24 @@ it("projects built-in resource acquisition and release", () => {
|
||||
).toMatchObject({ status: "partial" });
|
||||
});
|
||||
|
||||
it("does not project a literal property slot for dynamic destructuring", () => {
|
||||
const graph = graphFor(`
|
||||
const source = { token: "TOKEN" };
|
||||
const key = getKey();
|
||||
const { [key]: value } = source;
|
||||
`);
|
||||
|
||||
expect(
|
||||
graph.relations.filter(({ relation }) => relation === "destructures"),
|
||||
).toEqual([]);
|
||||
expect(
|
||||
graph.nodes.find(
|
||||
({ kind, properties }) =>
|
||||
kind === "property-slot" && properties.name === "key",
|
||||
),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it("projects literal seeds and static object flow", () => {
|
||||
const graph = graphFor(`
|
||||
const source = { token: "TOKEN", count: 1 };
|
||||
|
||||
Reference in new issue
Block a user