36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { buildRuntimeStatus } from '../../src/comm/runtime-state';
|
|
import { RuntimeService } from '../../src/modules/base/service/runtime';
|
|
|
|
describe('RuntimeService', () => {
|
|
it('returns status from runtime truth source', async () => {
|
|
const service = new RuntimeService();
|
|
service.getRuntimeStatus = jest.fn().mockResolvedValue(
|
|
buildRuntimeStatus({
|
|
port: 8008,
|
|
ready: true,
|
|
controlBaseUrl: 'http://127.0.0.1:8008',
|
|
dataDir: 'D:/NetaData',
|
|
logDir: 'D:/NetaData/logs',
|
|
configDir: 'C:/Program Files/Neta',
|
|
pid: 999,
|
|
startedAt: '2026-04-25T10:00:00.000Z',
|
|
})
|
|
);
|
|
|
|
await expect(service.getRuntimeStatus()).resolves.toMatchObject({
|
|
ready: true,
|
|
port: 8008,
|
|
controlBaseUrl: 'http://127.0.0.1:8008',
|
|
});
|
|
});
|
|
|
|
it('calls shutdown coordinator once', async () => {
|
|
const service = new RuntimeService();
|
|
const stop = jest.fn().mockResolvedValue(undefined);
|
|
service.registerStopHandler(stop);
|
|
|
|
await service.stopRuntime();
|
|
expect(stop).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|