* 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
16 lines
581 B
TypeScript
16 lines
581 B
TypeScript
import { getSystemResourceInfo } from './resource';
|
|
|
|
it('should return the correct system resource information with a valid CPU count', async () => {
|
|
const mockCpuCount = 4;
|
|
jest.spyOn(require('./config'), 'physicalCpuCount').mockResolvedValue(mockCpuCount);
|
|
const logSpy = jest.spyOn(require('./logger'), 'log').mockImplementation(() => {});
|
|
|
|
const result = await getSystemResourceInfo();
|
|
|
|
expect(result).toEqual({
|
|
numCpuPhysicalCore: mockCpuCount,
|
|
memAvailable: 0,
|
|
});
|
|
expect(logSpy).toHaveBeenCalledWith(`[CORTEX]::CPU information - ${mockCpuCount}`);
|
|
});
|