Skip to content

Commit

Permalink
Add tests showing the request params might be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
klippx committed Sep 12, 2024
1 parent 95b4ff9 commit 5aa6c66
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand Down

0 comments on commit 5aa6c66

Please sign in to comment.