refactor(frontend): replace legacy utils JS files with typed TS equivalents

This commit is contained in:
Yiannis
2026-03-11 01:51:53 +02:00
parent df4b0422d5
commit 1b8e8aae6a
48 changed files with 711 additions and 502 deletions

View File

@@ -5,7 +5,7 @@ jest.mock('axios');
const mockedAxios = axios as jest.Mocked<typeof axios>;
describe('js/utils/helpers', () => {
describe('utils/helpers', () => {
describe('requests', () => {
beforeEach(() => {
jest.clearAllMocks();
@@ -21,8 +21,8 @@ describe('js/utils/helpers', () => {
getRequest(url, false, cb, undefined);
expect(mockedAxios.get).toHaveBeenCalledWith(url, {
timeout: null,
maxContentLength: null,
timeout: undefined,
maxContentLength: undefined,
});
});
@@ -117,7 +117,7 @@ describe('js/utils/helpers', () => {
await postRequest(url, undefined as any, undefined as any, true, cb, undefined);
expect(mockedAxios.post).toHaveBeenCalledWith(url, {}, null);
expect(mockedAxios.post).toHaveBeenCalledWith(url, {}, undefined);
expect(cb).toHaveBeenCalled();
});
@@ -150,7 +150,7 @@ describe('js/utils/helpers', () => {
await putRequest(url, undefined as any, undefined as any, true, undefined, undefined);
expect(mockedAxios.put).toHaveBeenCalledWith(url, {}, null);
expect(mockedAxios.put).toHaveBeenCalledWith(url, {}, undefined);
});
test('Invokes errorCallback on error', async () => {