#708 apply strictier linting rules (#717)

* #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:
lethemanh
2026-04-01 22:15:10 +07:00
committed by GitHub
parent 2bff6aae78
commit cadfa70e60
321 changed files with 27452 additions and 27600 deletions
+26 -26
View File
@@ -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([])
})
})