From ff7cde40ac469608a47e54a1b924cfe011d0d019 Mon Sep 17 00:00:00 2001 From: ChK Date: Tue, 7 Apr 2026 22:53:57 +0200 Subject: [PATCH] tests --- test/GCode.test.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/test/GCode.test.js b/test/GCode.test.js index 21b8bdc..8cc7308 100755 --- a/test/GCode.test.js +++ b/test/GCode.test.js @@ -22,7 +22,7 @@ test('G28 ist ein GCode Command', () => { }) - test("ReadPosition -> G1", () => { + test("ReadPosition -> G1 -> telnetSender", () => { const L1 = 300; const L2 = 300; @@ -46,4 +46,28 @@ test('G28 ist ein GCode Command', () => { }); + test("ReadPosition -> G1 -> telnetSender -- empty", () => { + + const L1 = 300; + const L2 = 300; + const L3 = 20; + + const robot = new Robot(L1, L2, L3) + + var telnetSender1 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 2300, xAxisGrbl = "x", yAxisGrbl = "y", zAxisGrbl = "z"); + var telnetSender2 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 5000, xAxisGrbl = "x", yAxisGrbl = null, zAxisGrbl = null); + var telnetSender3 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 5000, xAxisGrbl = "a", yAxisGrbl = "y", zAxisGrbl = "b"); + + robot.cmdReceivers.push(telnetSender1); + robot.cmdReceivers.push(telnetSender2); + robot.cmdReceivers.push(telnetSender3); + + + GCode.receiveGCode(robot,"G1 x120"); + + expect(telnetSender2.tSocket.written.toString().length).toBeGreaterThan(2) + expect(telnetSender3.tSocket.written.toString().length).toBe(0) + }); + +