From 5aa6c664b8a09807a3821a28623d1055a22e7be1 Mon Sep 17 00:00:00 2001 From: Mathias Klippinge Date: Thu, 12 Sep 2024 08:55:51 +0200 Subject: [PATCH] Add tests showing the request params might be undefined --- src/request.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/request.spec.ts b/src/request.spec.ts index a97e853e..ea59e749 100755 --- a/src/request.spec.ts +++ b/src/request.spec.ts @@ -746,6 +746,11 @@ describe('Request', () => { const request = new Request(methodDescriptor, { differentParam: 'abc123' }) expect(request.body()).toEqual('abc123') }) + + it('can return undefined', () => { + const request = new Request(methodDescriptor, { ...requestParams, body: undefined }) + expect(request.body()).toBeUndefined() + }) }) describe('#auth', () => { @@ -763,6 +768,11 @@ describe('Request', () => { const request = new Request(methodDescriptor, { differentAuthParam: authData }) expect(request.auth()).toEqual(authData) }) + + it('can return undefined', () => { + const request = new Request(methodDescriptor, { ...requestParams, auth: undefined }) + expect(request.auth()).toBeUndefined() + }) }) describe('#timeout', () => { @@ -779,6 +789,11 @@ describe('Request', () => { const request = new Request(methodDescriptor, { differentTimeoutParam: 1000 }) expect(request.timeout()).toEqual(1000) }) + + it('can return undefined', () => { + const request = new Request(methodDescriptor, { ...requestParams, timeout: undefined }) + expect(request.timeout()).toBeUndefined() + }) }) describe('#signal', () => { @@ -800,6 +815,11 @@ describe('Request', () => { }) expect(request.signal()).toEqual(abortController.signal) }) + + it('can return undefined', () => { + const request = new Request(methodDescriptor, requestParams) + expect(request.signal()).toBeUndefined() + }) }) describe('#isBinary', () => {