diff --git a/src/Emulator.spec.ts b/src/Emulator.spec.ts index 4193f78..e8a993d 100644 --- a/src/Emulator.spec.ts +++ b/src/Emulator.spec.ts @@ -191,18 +191,20 @@ describe("Proxy", () => { expect($.target(proxy.toDelete)).toBe(undefined); }); - it("Will set a value to the original target", () => { + it("Adds a value to the original target", () => { const proxy = $.proxy(); - const deep = { test: true }; + const deep = { test: true, prox: true }; proxy.set = { object: true }; proxy.set.sub = {}; proxy.set.sub.deep = deep; proxy.set.sub.deep.test = false; $.proxy(deep).test = null; + $.proxy(deep).prox = $.proxy("test"); expect(deep.test).toBe(null); expect($.target($.proxy(deep).test)).toBe(null); + expect(deep.prox).toBe("test"); }); it("Can delete a property from a proxy and its original target", () => { diff --git a/src/utils/traps/apply.ts b/src/utils/traps/apply.ts index f1a1ddc..a9cf67e 100644 --- a/src/utils/traps/apply.ts +++ b/src/utils/traps/apply.ts @@ -21,7 +21,7 @@ const apply = ( let value: any; if (typeof target === "function") { - value = Reflect.apply(target, scope.target(that), args); + value = Reflect.apply(scope.target(target), scope.target(that), args); } const argList = args.map((arg) => createProxy(scope, arg, namespace, origin));