Logging
This commit is contained in:
@@ -81,7 +81,7 @@ describe('InputWS FCode-Routing', () => {
|
||||
expect(robot.sendCommand).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('Fileservice-Fehler → machine-readable FILE_ERROR an Sender', async () => {
|
||||
test('Fileservice-Fehler → spezifischer Fehlercode wird an Sender durchgereicht', async () => {
|
||||
const err = Object.assign(new Error('not found'), { code: 'PROGRAM_NOT_FOUND' });
|
||||
FCodeClient.handle.mockRejectedValue(err);
|
||||
await setup();
|
||||
@@ -89,7 +89,17 @@ describe('InputWS FCode-Routing', () => {
|
||||
ws.send('FLoad nichtda');
|
||||
const msg = JSON.parse(await replyP);
|
||||
expect(msg.type).toBe('error');
|
||||
expect(msg.code).toBe('FILE_ERROR');
|
||||
expect(msg.code).toBe('PROGRAM_NOT_FOUND'); // err.code wird durchgereicht (nicht pauschal FILE_ERROR)
|
||||
expect(msg.input).toBe('FLoad nichtda');
|
||||
});
|
||||
|
||||
test('Fehler ohne code → Fallback FILE_ERROR', async () => {
|
||||
FCodeClient.handle.mockRejectedValue(new Error('kaputt'));
|
||||
await setup();
|
||||
const replyP = nextMessage(ws);
|
||||
ws.send('FShow');
|
||||
const msg = JSON.parse(await replyP);
|
||||
expect(msg.type).toBe('error');
|
||||
expect(msg.code).toBe('FILE_ERROR');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user