Punkt 2 implementieren GitHub CoPilot
This commit is contained in:
@@ -93,4 +93,24 @@ describe('InputWS', () => {
|
||||
|
||||
client.close();
|
||||
});
|
||||
|
||||
test('receives GCode text and broadcasts updated position', async () => {
|
||||
server = http.createServer();
|
||||
const sharedState = { connectedClients: [], lastCommands: [], lastPings: [] };
|
||||
const robot = createDummyRobot();
|
||||
|
||||
wss = initInputWS(server, robot, GCode, sharedState);
|
||||
port = await listen(server);
|
||||
const client = await connectWebSocket(port);
|
||||
|
||||
const messagePromise = waitForMessage(client);
|
||||
client.send('G1 X1 Y2 Z3');
|
||||
|
||||
const message = await messagePromise;
|
||||
const parsed = JSON.parse(message);
|
||||
expect(parsed.position).toEqual({ x: 1, y: 2, z: 3, a: 0, b: 0, c: 0 });
|
||||
expect(robot.sendCommand).toHaveBeenCalled();
|
||||
|
||||
client.close();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user