* #708 apply strictier linting rules and fix simple eslint bugs * #708 fix eslint errors relate to promise * #708 fix eslint import/no-extraneous-dependencies * #708 fix eslint errors of react-hook * #708 enable eslint check for typescript --------- Co-authored-by: lethemanh <lethemanh@lethemanhs-MacBook-Pro.local>
This commit is contained in:
@@ -1,35 +1,35 @@
|
||||
import { EventErrorHandler } from "@/components/Error/EventErrorHandler";
|
||||
import { EventErrorHandler } from '@/components/Error/EventErrorHandler'
|
||||
|
||||
describe("EventErrorHandler", () => {
|
||||
it("calls the callback when a new error is reported", () => {
|
||||
const handler = new EventErrorHandler();
|
||||
const callback = jest.fn();
|
||||
describe('EventErrorHandler', () => {
|
||||
it('calls the callback when a new error is reported', () => {
|
||||
const handler = new EventErrorHandler()
|
||||
const callback = jest.fn()
|
||||
|
||||
handler.setErrorCallback(callback);
|
||||
handler.reportError("123", "Something broke");
|
||||
handler.setErrorCallback(callback)
|
||||
handler.reportError('123', 'Something broke')
|
||||
|
||||
expect(callback).toHaveBeenCalledWith(["Something broke"]);
|
||||
});
|
||||
expect(callback).toHaveBeenCalledWith(['Something broke'])
|
||||
})
|
||||
|
||||
it("does not duplicate errors for same eventId", () => {
|
||||
const handler = new EventErrorHandler();
|
||||
const callback = jest.fn();
|
||||
it('does not duplicate errors for same eventId', () => {
|
||||
const handler = new EventErrorHandler()
|
||||
const callback = jest.fn()
|
||||
|
||||
handler.setErrorCallback(callback);
|
||||
handler.reportError("A", "Error 1");
|
||||
handler.reportError("A", "Error 1 again");
|
||||
handler.setErrorCallback(callback)
|
||||
handler.reportError('A', 'Error 1')
|
||||
handler.reportError('A', 'Error 1 again')
|
||||
|
||||
expect(callback).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
expect(callback).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it("clears errors properly", () => {
|
||||
const handler = new EventErrorHandler();
|
||||
const callback = jest.fn();
|
||||
it('clears errors properly', () => {
|
||||
const handler = new EventErrorHandler()
|
||||
const callback = jest.fn()
|
||||
|
||||
handler.setErrorCallback(callback);
|
||||
handler.reportError("A", "Error 1");
|
||||
handler.clearAll();
|
||||
handler.setErrorCallback(callback)
|
||||
handler.reportError('A', 'Error 1')
|
||||
handler.clearAll()
|
||||
|
||||
expect(callback).toHaveBeenLastCalledWith([]);
|
||||
});
|
||||
});
|
||||
expect(callback).toHaveBeenLastCalledWith([])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user