import { ContentsquareModule } from '../../core/nativeModules'; import { registerWebView, unregisterWebView, } from '../../webview/csqWebViewMethods'; jest.mock('../../core/nativeModules', () => ({ ContentsquareModule: { registerWebView: jest.fn(), unregisterWebView: jest.fn(), }, })); describe('csqWebViewMethods', () => { beforeEach(() => { jest.clearAllMocks(); }); describe('registerWebView', () => { it('should call ContentsquareModule.registerWebView with the correct webViewTag', () => { const webViewTag = 123; registerWebView(webViewTag); expect(ContentsquareModule.registerWebView).toHaveBeenCalledWith( webViewTag ); expect(ContentsquareModule.registerWebView).toHaveBeenCalledTimes(1); }); }); describe('unregisterWebView', () => { it('should call ContentsquareModule.unregisterWebView with the correct webViewTag', () => { const webViewTag = 456; unregisterWebView(webViewTag); expect(ContentsquareModule.unregisterWebView).toHaveBeenCalledWith( webViewTag ); expect(ContentsquareModule.unregisterWebView).toHaveBeenCalledTimes(1); }); }); });