import { ErrorReporter } from '..'; describe('ErrorReporter', () => { beforeEach(() => { jest.resetAllMocks(); jest.useFakeTimers(); }); afterEach(() => { jest.useRealTimers(); localStorage.clear(); }); afterAll(() => { jest.resetAllMocks(); }); it('configure logError correctly', () => { const reporter = new ErrorReporter() as any; reporter.init({}); expect(reporter.logError).toBe(true); const reporterWithOptions = new ErrorReporter() as any; reporterWithOptions.setOptions({ logError: true, }); expect(reporterWithOptions.logError).toBe(true); reporterWithOptions.init({ logError: false, }); expect(reporterWithOptions.logError).toBe(false); }); });