Skip to content

Commit

Permalink
fix: ajusta test
Browse files Browse the repository at this point in the history
  • Loading branch information
drusco committed Aug 1, 2023
1 parent 307eb16 commit c15d39c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Emulator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/traps/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit c15d39c

Please sign in to comment.