* chore: add core module test cases * chore: fix tests * chore: add code coverage report * chore: split coverage step * chore: split coverage step * Update jan-electron-linter-and-test.yml * Update jan-electron-linter-and-test.yml * Update jan-electron-linter-and-test.yml * chore: update tests * chore: add web utils test cases * chore: add restful and helper tests * chore: add tests
26 lines
798 B
TypeScript
26 lines
798 B
TypeScript
import { CoreRoutes } from '../../../types/api';
|
|
import { RequestHandler } from './handler';
|
|
import { RequestAdapter } from './adapter';
|
|
|
|
it('should not call handler if CoreRoutes is empty', () => {
|
|
const mockHandler = jest.fn();
|
|
const mockObserver = jest.fn();
|
|
const requestHandler = new RequestHandler(mockHandler, mockObserver);
|
|
|
|
CoreRoutes.length = 0; // Ensure CoreRoutes is empty
|
|
|
|
requestHandler.handle();
|
|
|
|
expect(mockHandler).not.toHaveBeenCalled();
|
|
});
|
|
|
|
|
|
it('should initialize handler and adapter correctly', () => {
|
|
const mockHandler = jest.fn();
|
|
const mockObserver = jest.fn();
|
|
const requestHandler = new RequestHandler(mockHandler, mockObserver);
|
|
|
|
expect(requestHandler.handler).toBe(mockHandler);
|
|
expect(requestHandler.adapter).toBeInstanceOf(RequestAdapter);
|
|
});
|