mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-19 15:54:27 +02:00
Merge branch 'dev' into feature/oidc-env-config
This commit is contained in:
@@ -143,6 +143,38 @@ describe('ConnectionDiagnosticModal', () => {
|
||||
spy.mockRestore();
|
||||
});
|
||||
|
||||
it('names a refused access code when the printer said so (#2698)', async () => {
|
||||
const spy = vi.spyOn(api, 'diagnosePrinter').mockResolvedValue({
|
||||
...PROBLEM_RESULT,
|
||||
checks: [{ id: 'mqtt_auth', status: 'fail', params: { reason: 'auth_rejected' } }],
|
||||
});
|
||||
|
||||
renderModal({ printerId: 1, printerName: 'Test A1', onClose: vi.fn() });
|
||||
|
||||
await waitFor(() => expect(spy).toHaveBeenCalledTimes(1));
|
||||
// States the printer refused us, instead of the hedged "most likely wrong"
|
||||
// text used when all we know is that there's no session.
|
||||
expect(await screen.findByText(/refused Bambuddy's credentials/i)).toBeInTheDocument();
|
||||
expect(screen.queryByText(/most likely wrong/i)).not.toBeInTheDocument();
|
||||
|
||||
spy.mockRestore();
|
||||
});
|
||||
|
||||
it('hedges on the mqtt_auth failure when the printer gave no reason (#2698)', async () => {
|
||||
const spy = vi.spyOn(api, 'diagnosePrinter').mockResolvedValue({
|
||||
...PROBLEM_RESULT,
|
||||
checks: [{ id: 'mqtt_auth', status: 'fail', params: {} }],
|
||||
});
|
||||
|
||||
renderModal({ printerId: 1, printerName: 'Test A1', onClose: vi.fn() });
|
||||
|
||||
await waitFor(() => expect(spy).toHaveBeenCalledTimes(1));
|
||||
expect(await screen.findByText(/most likely wrong/i)).toBeInTheDocument();
|
||||
expect(screen.queryByText(/refused Bambuddy's credentials/i)).not.toBeInTheDocument();
|
||||
|
||||
spy.mockRestore();
|
||||
});
|
||||
|
||||
it('falls back to the generic skip text when no reason is present', async () => {
|
||||
const spy = vi.spyOn(api, 'diagnosePrinter').mockResolvedValue({
|
||||
...PROBLEM_RESULT,
|
||||
|
||||
Reference in New Issue
Block a user