From cd32cba5912192bbac62db4d5bbf4047ce955579 Mon Sep 17 00:00:00 2001 From: Flaminel Date: Wed, 14 Oct 2026 12:12:31 +0300 Subject: [PATCH] added digest fallback and auth type default tests --- .../download-clients.component.spec.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/code/frontend/src/app/features/settings/download-clients/download-clients.component.spec.ts b/code/frontend/src/app/features/settings/download-clients/download-clients.component.spec.ts index 177a2ce1..51bf0046 100644 --- a/code/frontend/src/app/features/settings/download-clients/download-clients.component.spec.ts +++ b/code/frontend/src/app/features/settings/download-clients/download-clients.component.spec.ts @@ -899,6 +899,33 @@ describe('DownloadClientsComponent', () => { ); }); + it('defaults the HTTP auth type to Basic for a client with none stored', () => { + const clientWithoutAuthType: ClientConfig = { ...QBIT, httpAuthType: undefined as unknown as HttpAuthType }; + const { fixture, component } = setup(createApi({ clients: [clientWithoutAuthType] })); + + component.openEditModal(clientWithoutAuthType); + fixture.detectChanges(); + + expect(component.clientModel().httpAuthType).toBe(HttpAuthType.Basic); + }); + + it('does not require a Digest username while the types are still loading', () => { + const types$ = new Subject(); + const api = createApi(); + api.getTypes.mockReturnValue(types$); + const { fixture, component } = setup(api); + + component.openAddModal(); + component.clientForm.name().value.set('qbit box'); + component.clientForm.host().value.set('http://localhost:8080'); + component.clientForm.httpAuthType().value.set(HttpAuthType.Digest); + fixture.detectChanges(); + + expect(component.hasModalErrors()).toBe(false); + expect(component.clientForm.httpAuthUsername().errors()).toEqual([]); + expect(component.clientForm.username().errors()).toEqual([]); + }); + it('loads the saved HTTP auth type and credentials into the form', () => { const qbitWithHttpAuth: ClientConfig = { ...QBIT,