Skip to content

Commit

Permalink
Fix missin statusCode getter in ResponseError.class
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSanEM committed Jan 10, 2024
1 parent 5d515ba commit 922acc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions classes/ResponseError.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ResponseError extends Error {
this.response = response
}

get statusCode () { return this.response.code }
get responseText () { return this.response.responseText }
get buffer () { return this.response.buffer }

Expand Down
12 changes: 12 additions & 0 deletions test/classes/ResponseError.class.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ describe('ResponseError', () => {
expect(responeError.stats).to.equal(response)
}))

describe('get statusCode', () => it('should return the value of response', () => {
const responeError = new ResponseError('Error Message', response)

expect(responeError.statusCode).to.equal(response.statusCode)
}))

describe('get responseText', () => it('should return the value of response', () => {
const responeError = new ResponseError('Error Message', response)

expect(responeError.responseText).to.equal(response.responseText)
}))

describe('get buffer', () => it('should return the value of response', () => {
const responeError = new ResponseError('Error Message', response)

Expand Down

0 comments on commit 922acc8

Please sign in to comment.