Skip to content

Commit

Permalink
Fix plug proxy (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospassos committed Apr 26, 2023
1 parent 0ca9f4d commit 283cb1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/CroctProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jest.mock(
croct: {
plug: jest.fn(),
unplug: jest.fn().mockResolvedValue(undefined),
plugged: true,
},
}),
);
Expand All @@ -22,7 +23,9 @@ describe('<CroctProvider />', () => {
afterEach(() => {
// eslint-disable-next-line no-console -- Needed to restore the original console.error.
console.error = consoleError;
});

beforeEach(() => {
jest.clearAllMocks();
});

Expand Down Expand Up @@ -109,7 +112,7 @@ describe('<CroctProvider />', () => {

plug?.plug({appId: appId});

expect(croct.plug).toHaveBeenCalledTimes(2);
expect(plug?.plugged).toBe(croct.plugged);

expect(croct.plug).toHaveBeenLastCalledWith({
...options,
Expand Down
2 changes: 1 addition & 1 deletion src/CroctProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const CroctProvider: FunctionComponent<CroctProviderProps> = (props): Rea
};
}

return target.plug[property];
return target[property];
},
});
},
Expand Down

0 comments on commit 283cb1c

Please sign in to comment.