-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: remove messages for assert #16814
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
'use strict'; | ||
|
||
const common = require('../../common'); | ||
const test_promise = require(`./build/${common.buildType}/test_promise`); | ||
const assert = require('assert'); | ||
|
||
// Testing api calls for promises | ||
const test_promise = require(`./build/${common.buildType}/test_promise`); | ||
|
||
// A resolution | ||
{ | ||
const expected_result = 42; | ||
const promise = test_promise.createPromise(); | ||
promise.then( | ||
common.mustCall(function(result) { | ||
assert.strictEqual(result, expected_result, | ||
`promise resolved as expected, received ${result}`); | ||
assert.strictEqual(result, expected_result); | ||
}), | ||
common.mustNotCall()); | ||
test_promise.concludeCurrentPromise(expected_result, true); | ||
|
@@ -24,23 +25,25 @@ const assert = require('assert'); | |
promise.then( | ||
common.mustNotCall(), | ||
common.mustCall(function(result) { | ||
assert.strictEqual(result, expected_result, | ||
`promise rejected as expected, received ${result}`); | ||
assert.strictEqual(result, expected_result); | ||
})); | ||
test_promise.concludeCurrentPromise(expected_result, false); | ||
} | ||
|
||
// Chaining | ||
const promise = test_promise.createPromise(); | ||
promise.then( | ||
common.mustCall(function(result) { | ||
assert.strictEqual(result, 'chained answer', | ||
'resolving with a promise chains properly'); | ||
}), | ||
common.mustNotCall()); | ||
test_promise.concludeCurrentPromise(Promise.resolve('chained answer'), true); | ||
{ | ||
const expected_result = 'chained answer'; | ||
const promise = test_promise.createPromise(); | ||
promise.then( | ||
common.mustCall(function(result) { | ||
assert.strictEqual(result, expected_result); | ||
}), | ||
common.mustNotCall()); | ||
test_promise.concludeCurrentPromise(Promise.resolve('chained answer'), true); | ||
|
||
assert.strictEqual(test_promise.isPromise(promise), true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one does not seem to belong here, can you move it back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @joyeecheung I suggested putting it in there because it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm yes, actually it should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved it out from the block, created new promise as @joyeecheung suggested |
||
} | ||
|
||
assert.strictEqual(test_promise.isPromise(promise), true); | ||
assert.strictEqual(test_promise.isPromise(Promise.reject(-1)), true); | ||
assert.strictEqual(test_promise.isPromise(2.4), false); | ||
assert.strictEqual(test_promise.isPromise('I promise!'), false); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you format the comment as what testing guide suggests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!