diff --git a/src/CroctProvider.test.tsx b/src/CroctProvider.test.tsx index 3c6b02e5..9099c238 100644 --- a/src/CroctProvider.test.tsx +++ b/src/CroctProvider.test.tsx @@ -11,6 +11,7 @@ jest.mock( croct: { plug: jest.fn(), unplug: jest.fn().mockResolvedValue(undefined), + plugged: true, }, }), ); @@ -22,7 +23,9 @@ describe('', () => { afterEach(() => { // eslint-disable-next-line no-console -- Needed to restore the original console.error. console.error = consoleError; + }); + beforeEach(() => { jest.clearAllMocks(); }); @@ -109,7 +112,7 @@ describe('', () => { plug?.plug({appId: appId}); - expect(croct.plug).toHaveBeenCalledTimes(2); + expect(plug?.plugged).toBe(croct.plugged); expect(croct.plug).toHaveBeenLastCalledWith({ ...options, diff --git a/src/CroctProvider.tsx b/src/CroctProvider.tsx index b6c923b7..8b5ba0ba 100644 --- a/src/CroctProvider.tsx +++ b/src/CroctProvider.tsx @@ -54,7 +54,7 @@ export const CroctProvider: FunctionComponent = (props): Rea }; } - return target.plug[property]; + return target[property]; }, }); },