I am running Supertest, Jasmine and Chai to auto-test an HTTP API.
Expectations like this work:
.expect( function(response) {
expect(response.body.minVersion).to.equal(undefined)
expect(response.body.errorMessage).to.equal("Incorrect parameters provided. This API requires a single \"path\" parameter. e.g. /file-compatibility?path=C%25%2FData%2FMy File.adicht")
expect(response.body.result).to.equal("error")
})
Whereas when I destructure the HTTP response I get an error [SyntaxError: Unexpected token { ]:
.expect( function(response) {
const { body } = response
expect(body.minVersion).to.equal(undefined)
expect(body.errorMessage).to.equal("Incorrect parameters provided. This API requires a single \"path\" parameter. e.g. /file-compatibility?path=C%25%2FData%2FMy File.adicht")
expect(body.result).to.equal("error")
})
It may be that this is not supported in one of these frameworks but I have being using ECMA 6 keywords such as 'let' and 'const' in the same file.