This commit is contained in:
ChK
2026-04-03 22:57:17 +02:00
parent 71d04271db
commit 8ea33bd8df
4 changed files with 1645 additions and 62 deletions

View File

@@ -1,60 +0,0 @@
const WebSocket = require('ws');
const TEST_URL = "wss://localhost:2095";
describe("WebSocket Verbindung (appRobot_Driver)", () => {
let ws;
beforeAll((done) => {
// self-signed cert ignorieren (wichtig!)
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
ws = new WebSocket(TEST_URL);
ws.on('open', () => {
done();
});
ws.on('error', (err) => {
done(err);
});
});
afterAll(() => {
if (ws) ws.close();
});
test("Ping → sollte Antwort bekommen", (done) => {
ws.on('message', (data) => {
const msg = data.toString();
try {
expect(msg).toBe("Ping");
done();
} catch (err) {
done(err);
}
});
ws.send("Ping");
});
test("GCode senden → sollte Antwort liefern", (done) => {
ws.on('message', (data) => {
const msg = data.toString();
try {
expect(msg).toContain("X"); // M114 response enthält Positionsdaten
done();
} catch (err) {
done(err);
}
});
ws.send("G1 X10 F100");
});
});