Emergency Stop

This commit is contained in:
chk
2026-06-12 18:16:15 +02:00
parent 6fc6605080
commit 59d4cf7df4
17 changed files with 1098 additions and 540 deletions

View File

@@ -21,6 +21,10 @@ describe('startRobot orchestrator', () => {
const createInfoServer = jest.fn(() => infoServerMock);
const TelnetSenderClass = jest.fn(() => ({ tSocket: null }));
// Shelly-Mock: getStatus() liefert state='ready' (kein tSocket, kein isTestMode)
const ShellyClass = jest.fn(() => ({
getStatus: () => ({ state: 'ready', url: null, error: null })
}));
const robotInstances = [];
class RobotClass {
@@ -37,6 +41,7 @@ describe('startRobot orchestrator', () => {
RobotClass,
GCodeModule: { dummy: true },
TelnetSenderClass,
ShellyClass,
initInputWSFn: initInputWS,
createInfoServerFn: createInfoServer,
setTimeoutFn: (fn) => fn(),
@@ -58,9 +63,10 @@ describe('startRobot orchestrator', () => {
expect.any(RobotClass),
{ dummy: true },
expect.arrayContaining([
expect.objectContaining({ name: 'Base', instance: expect.any(Object) }),
expect.objectContaining({ name: 'Elbow', instance: expect.any(Object) }),
expect.objectContaining({ name: 'Hand', instance: expect.any(Object) })
expect.objectContaining({ name: 'Base', instance: expect.any(Object) }),
expect.objectContaining({ name: 'Elbow', instance: expect.any(Object) }),
expect.objectContaining({ name: 'Hand', instance: expect.any(Object) }),
expect.objectContaining({ name: 'EmergencyStop', instance: expect.any(Object) })
]),
expect.objectContaining({}) // options: { apiKey }
);
@@ -71,13 +77,18 @@ describe('startRobot orchestrator', () => {
expect(result).toHaveProperty('httpsServer', httpsServerMock);
expect(result).toHaveProperty('infoServer', infoServerMock);
expect(result).toHaveProperty('senders');
expect(result.senders).toHaveLength(3);
expect(result.senders).toHaveLength(4); // base, elbow, hand, emergencyStop
// Nur Telnet-Sender (3) landen in cmdReceivers — Shelly nicht
expect(robotInstances[0].cmdReceivers).toHaveLength(3);
expect(result.startupStatus).toEqual({
https: { ok: true },
senders: [
{ name: 'Base', status: 'disconnected', reason: 'no active socket connection' },
{ name: 'Elbow', status: 'disconnected', reason: 'no active socket connection' },
{ name: 'Hand', status: 'disconnected', reason: 'no active socket connection' }
{ name: 'Base', status: 'disconnected', reason: 'no active socket connection' },
{ name: 'Elbow', status: 'disconnected', reason: 'no active socket connection' },
{ name: 'Hand', status: 'disconnected', reason: 'no active socket connection' },
{ name: 'EmergencyStop', status: 'ready', reason: undefined }
]
});
expect(result.sharedState.connectedClients).toEqual([]);