Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Currently, unit test will fail in Nodejs 6 and Nodejs 8.
https://rackhd.atlassian.net/browse/RAC-6232
AC:
Detail
About case Http.Server rest().should 500 if a deserializer returns a rejected promise (from Mocha Tests)
AssertionError: expected 'err.toString(...).contains is not a function' to equal 'deserializer reject!' at spec/lib/services/rest-api-service-spec.js:418:31 at Test._assertFunction (node_modules/supertest/lib/test.js:247:11) at Test.assert (node_modules/supertest/lib/test.js:148:18) at assert (node_modules/supertest/lib/test.js:127:12) at node_modules/supertest/lib/test.js:124:5 at Test.Request.callback (node_modules/superagent/lib/node/index.js:703:3) at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:922:12) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickDomainCallback (internal/process/next_tick.js:128:9)
traceur(0.0.33) override String and provides "contains()" function. But new version of traceur doesn't provide that.
Change "contains()" to "includes()"
About case Http.Server rest() should 400 when POSTing bad JSON
AssertionError: expected 'Error parsing JSON: Unexpected token b in JSON at position 1' to equal 'Error parsing JSON: Unexpected token b'
*Cause:
In Node4 the return error message is
Error parsing JSON: Unexpected token b
But in Node6
Error parsing JSON: Unexpected token b in JSON at position 1
*Fix:
Use
.to.match(/Error parsing JSON: Unexpected token b.*/)
Instead of
.to.equal('Error parsing JSON: Unexpected token b')
About case Http.Api.Users should 201 a user post attempt with localexception
Error: expected { username: 'admin', role: 'Administrator' } response body, got { message: 'parsed_url.query.hasOwnProperty is not a function', status: '400', UUID: 'c7a85886-0d25-4cf3-b761-491c42397eda' } + expected - actual { - "UUID": "c7a85886-0d25-4cf3-b761-491c42397eda" - "message": "parsed_url.query.hasOwnProperty is not a function" - "status": "400" + "role": "Administrator" + "username": "admin" }
*Cause:
Third party module bug
*Fix:
Update passport-jwt@2.0.0 to passport-jwt@3.0.0
For case AssertionError
This is the same issue with on-tasks
Change
expect(err.name).equals('xxx'); {code}
expect(err.name).match(/xxx.*/);
@iceiilin @anhou @pengz1 @bbcyyb @PengTian0